Merge pull request #125 from KayenEQ/master

Added lower bounds for chance of charm fading.
This commit is contained in:
Michael Cook 2014-03-02 20:40:34 -05:00
commit 9e4cf19e0c
3 changed files with 15 additions and 8 deletions

View File

@ -1393,6 +1393,7 @@ bool Mob::PassCharismaCheck(Mob* caster, Mob* spellTarget, uint16 spell_id) {
Charisma ONLY effects the initial resist check when charm is cast with 10 CHA = -1 Resist mod up to 200 CHA Charisma ONLY effects the initial resist check when charm is cast with 10 CHA = -1 Resist mod up to 200 CHA
Charisma DOES NOT extend charm durations. Charisma DOES NOT extend charm durations.
Base effect value of charm spells in the spell file DOES NOT effect duration OR resist rate (unclear if does anything) Base effect value of charm spells in the spell file DOES NOT effect duration OR resist rate (unclear if does anything)
Charm has a lower limit of 5% chance to break per tick, regardless of resist modifiers / level difference.
*/ */
if(!caster) return false; if(!caster) return false;
@ -1402,11 +1403,6 @@ bool Mob::PassCharismaCheck(Mob* caster, Mob* spellTarget, uint16 spell_id) {
float resist_check = 0; float resist_check = 0;
if (RuleB(Spells, CharismaCharmDuration))
resist_check = ResistSpell(spells[spell_id].resisttype, spell_id, caster,0,0,true);
else
resist_check = ResistSpell(spells[spell_id].resisttype, spell_id, caster);
if(IsCharmSpell(spell_id)) { if(IsCharmSpell(spell_id)) {
if (spells[spell_id].powerful_flag == -1) //If charm spell has this set(-1), it can not break till end of duration. if (spells[spell_id].powerful_flag == -1) //If charm spell has this set(-1), it can not break till end of duration.
@ -1416,8 +1412,13 @@ bool Mob::PassCharismaCheck(Mob* caster, Mob* spellTarget, uint16 spell_id) {
if (MakeRandomInt(0, 99) > RuleI(Spells, CharmBreakCheckChance)) if (MakeRandomInt(0, 99) > RuleI(Spells, CharmBreakCheckChance))
return true; return true;
if (RuleB(Spells, CharismaCharmDuration))
resist_check = ResistSpell(spells[spell_id].resisttype, spell_id, caster,0,0,true,true);
else
resist_check = ResistSpell(spells[spell_id].resisttype, spell_id, caster, 0,0, false, true);
//2: The mob makes a resistance check against the charm //2: The mob makes a resistance check against the charm
if (resist_check == 100) if (resist_check == 100)
return true; return true;
else else
@ -1437,6 +1438,8 @@ bool Mob::PassCharismaCheck(Mob* caster, Mob* spellTarget, uint16 spell_id) {
else else
{ {
// Assume this is a harmony/pacify spell // Assume this is a harmony/pacify spell
resist_check = ResistSpell(spells[spell_id].resisttype, spell_id, caster);
if (resist_check == 100) if (resist_check == 100)
return true; return true;
} }

View File

@ -190,7 +190,7 @@ public:
virtual int32 GetActSpellDuration(uint16 spell_id, int32 duration){ return duration;} virtual int32 GetActSpellDuration(uint16 spell_id, int32 duration){ return duration;}
virtual int32 GetActSpellCasttime(uint16 spell_id, int32 casttime); virtual int32 GetActSpellCasttime(uint16 spell_id, int32 casttime);
float ResistSpell(uint8 resist_type, uint16 spell_id, Mob *caster, bool use_resist_override = false, float ResistSpell(uint8 resist_type, uint16 spell_id, Mob *caster, bool use_resist_override = false,
int resist_override = 0, bool CharismaCheck = false); int resist_override = 0, bool CharismaCheck = false, bool CharmTick = false);
uint16 GetSpecializeSkillValue(uint16 spell_id) const; uint16 GetSpecializeSkillValue(uint16 spell_id) const;
void SendSpellBarDisable(); void SendSpellBarDisable();
void SendSpellBarEnable(uint16 spellid); void SendSpellBarEnable(uint16 spellid);

View File

@ -4048,7 +4048,7 @@ bool Mob::IsImmuneToSpell(uint16 spell_id, Mob *caster)
// pvp_resist_base // pvp_resist_base
// pvp_resist_calc // pvp_resist_calc
// pvp_resist_cap // pvp_resist_cap
float Mob::ResistSpell(uint8 resist_type, uint16 spell_id, Mob *caster, bool use_resist_override, int resist_override, bool CharismaCheck) float Mob::ResistSpell(uint8 resist_type, uint16 spell_id, Mob *caster, bool use_resist_override, int resist_override, bool CharismaCheck, bool CharmTick)
{ {
if(!caster) if(!caster)
@ -4277,6 +4277,10 @@ float Mob::ResistSpell(uint8 resist_type, uint16 spell_id, Mob *caster, bool use
resist_chance = spells[spell_id].MinResist; resist_chance = spells[spell_id].MinResist;
} }
//Charm can not have less than 5% chance to fail.
if (CharmTick && (resist_chance < 10))
resist_chance = 10;
//Finally our roll //Finally our roll
int roll = MakeRandomInt(0, 200); int roll = MakeRandomInt(0, 200);
if(roll > resist_chance) if(roll > resist_chance)