Jump to content

Need help on GTB Script.


Recommended Posts


  • Group:  Members
  • Topic Count:  14
  • Topics Per Day:  0.01
  • Content Count:  43
  • Reputation:   1
  • Joined:  06/24/22
  • Last Seen:  

The problem is that GTB doesn't block coma from item bonuses, but it can block skills like Tarot.
The item bonuses that can't be blocked by GTB are as follows:

  • bonus2 bComaClass,c,n;
  • bonus2 bComaRace,r,n;
  • bonus2 bWeaponComaEle,e,n;
  • bonus2 bWeaponComaClass,c,n;
  • bonus2 bWeaponComaRace,r,n;


Status.cpp

t_tick status_get_sc_def(struct block_list *src, struct block_list *bl, enum sc_type type, int rate, t_tick tick, unsigned char flag)
{
    /// Resistance rate: 10000 = 100%
    /// Example:    50% (5000) -> sc_def = 5000 -> 25%;
    ///                5000ms -> tick_def = 5000 -> 2500ms
    int sc_def = 0, tick_def = -1; // -1 = use sc_def
    /// Fixed resistance value (after rate calculation)
    /// Example:    25% (2500) -> sc_def2 = 2000 -> 5%;
    ///                2500ms -> tick_def2=2000 -> 500ms
    int sc_def2 = 0, tick_def2 = 0;
    status_change *sc;
    map_session_data *sd;

    nullpo_ret(bl);
    if (src == nullptr)
        return tick?tick:1; // This should not happen in current implementation, but leave it anyway

    // Skills (magic type) that are blocked by Golden Thief Bug card or Wand of Hermod
    if (status_isimmune(bl)) {
        switch (type) {
            case SC_DECREASEAGI:
            case SC_SILENCE:
            case SC_COMA:
            case SC_INCREASEAGI:
            case SC_BLESSING:
            case SC_SLOWPOISON:
            case SC_IMPOSITIO:
            case SC_AETERNA:
            case SC_SUFFRAGIUM:
            case SC_BENEDICTIO:
            case SC_PROVIDENCE:
            case SC_KYRIE:
            case SC_ASSUMPTIO:
            case SC_ANGELUS:
            case SC_MAGNIFICAT:
            case SC_GLORIA:
            case SC_WINDWALK:
            case SC_MAGICROD:
            case SC_HALLUCINATION:
            case SC_STONE:
            case SC_QUAGMIRE:
            case SC_SUITON:
            case SC_SWINGDANCE:
            case SC_FIRE_INSIGNIA:
            case SC_WATER_INSIGNIA:
            case SC_WIND_INSIGNIA:
            case SC_EARTH_INSIGNIA:
                return 0;
        }
        std::shared_ptr<s_skill_db> skill = skill_db.find(battle_getcurrentskill(src));

        if (skill == nullptr) // Check for ground-type skills using the status when a player moves through units
            skill = skill_db.find(status_db.getSkill(type));

        if (skill != nullptr && skill->skill_type == BF_MAGIC && // Basic magic skill
            !skill->inf2[INF2_IGNOREGTB] && // Specific skill to bypass
            ((skill->inf == INF_ATTACK_SKILL || skill->inf == INF_GROUND_SKILL || skill->inf == INF_SUPPORT_SKILL) || // Target skills should get blocked even when cast on self
             (skill->inf == INF_SELF_SKILL && src != bl))) // Self skills should get blocked on all targets except self
            return 0;
    }


My git version.
image.png.56ce7c80d87ace1d2b78bf9238c8f66c.png

Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  36
  • Topics Per Day:  0.01
  • Content Count:  876
  • Reputation:   247
  • Joined:  01/30/13
  • Last Seen:  

This is official behavior though. GTB only blocks magic-type skills, it does not protect from Coma.

I guess looking at your code, you want to customize it so that GTB also blocks various other effects. I don't understand why someone would want to buff GTB card even more, but if you really want to still do it, you need to understand that Coma is no longer a status change, it actually overwrites damage and sets it to "TargetCurrentHP - 1".

The logic for Coma is now in status_damage:

	// We need to log the real damage on exp_calc_type 1
	if (battle_config.exp_calc_type == 1) {
		dhp = hp;
		// Coma real damage
		if (flag&16)
			dhp = status->hp - 1;
	}

	status->hp-= hp;
	status->sp-= sp;
	status->ap-= ap;

	// Coma
	if (flag&16) {
		status->hp = 1;
		status->sp = 1;
		if (!sp) sp = 1; // To make sure the status bar is updated
	}

It's called from battle_damage in battle.cpp here:

	else if (sd && battle_check_coma(*sd, *target, (e_battle_flag)attack_type))
		dmg_change = status_damage(src, target, damage, 0, delay, 16, skill_id); // Coma attack

Probably easiest to add the check for status_isimmune there:

	else if (sd && battle_check_coma(*sd, *target, (e_battle_flag)attack_type) && !status_isimmune(target))
		dmg_change = status_damage(src, target, damage, 0, delay, 16, skill_id); // Coma attack

 

  • Love 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  14
  • Topics Per Day:  0.01
  • Content Count:  43
  • Reputation:   1
  • Joined:  06/24/22
  • Last Seen:  

6 hours ago, Playtester said:

This is official behavior though. GTB only blocks magic-type skills, it does not protect from Coma.

I guess looking at your code, you want to customize it so that GTB also blocks various other effects. I don't understand why someone would want to buff GTB card even more, but if you really want to still do it, you need to understand that Coma is no longer a status change, it actually overwrites damage and sets it to "TargetCurrentHP - 1".

The logic for Coma is now in status_damage:

	// We need to log the real damage on exp_calc_type 1
	if (battle_config.exp_calc_type == 1) {
		dhp = hp;
		// Coma real damage
		if (flag&16)
			dhp = status->hp - 1;
	}

	status->hp-= hp;
	status->sp-= sp;
	status->ap-= ap;

	// Coma
	if (flag&16) {
		status->hp = 1;
		status->sp = 1;
		if (!sp) sp = 1; // To make sure the status bar is updated
	}

It's called from battle_damage in battle.cpp here:

	else if (sd && battle_check_coma(*sd, *target, (e_battle_flag)attack_type))
		dmg_change = status_damage(src, target, damage, 0, delay, 16, skill_id); // Coma attack

Probably easiest to add the check for status_isimmune there:

	else if (sd && battle_check_coma(*sd, *target, (e_battle_flag)attack_type) && !status_isimmune(target))
		dmg_change = status_damage(src, target, damage, 0, delay, 16, skill_id); // Coma attack

 

 

Thank you so much! I have a custom weapon for the High Priest on my server that has a high chance of causing coma to players, which is why I was looking for the old behavior of the GTB. It is now completely blocking. Once again, thank you so much!

Edited by rizsu0107
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...