Retooled how cooldowns work so they should be more consistent with how the client shows them

This commit is contained in:
KimLS 2015-06-16 21:43:51 -07:00
parent d3280c9676
commit 60f2e31240
2 changed files with 5 additions and 18 deletions

View File

@ -1137,26 +1137,16 @@ void Client::ActivateAlternateAdvancementAbility(int rank_id, int target_id) {
// Bards can cast instant cast AAs while they are casting another song
if(spells[rank->spell].cast_time == 0 && GetClass() == BARD && IsBardSong(casting_spell_id)) {
if(!SpellFinished(rank->spell, entity_list.GetMob(target_id), 10, -1, -1, spells[rank->spell].ResistDiff, false)) {
//Reset on failed cast
SendAlternateAdvancementTimer(rank->spell_type, 0, -1);
Message_StringID(15, ABILITY_FAILED);
p_timers.Clear(&database, rank->spell_type + pTimerAAStart);
return;
}
CastToClient()->GetPTimers().Start(rank->spell_type, cooldown);
SendAlternateAdvancementTimer(rank->spell_type, 0, 0);
ExpendAlternateAdvancementCharge(ability->id);
} else {
if(!CastSpell(rank->spell, target_id, USE_ITEM_SPELL_SLOT, -1, -1, 0, -1, rank->spell_type + pTimerAAStart, cooldown, 1, nullptr, ability->id)) {
//Reset on failed cast
SendAlternateAdvancementTimer(rank->spell_type, 0, -1);
Message_StringID(15, ABILITY_FAILED);
p_timers.Clear(&database, rank->spell_type + pTimerAAStart);
return;
}
}
if(cooldown > 0) {
SendAlternateAdvancementTimer(rank->spell_type, 0, 0);
}
}
int Mob::GetAlternateAdvancementCooldownReduction(AA::Rank *rank_in) {

View File

@ -819,12 +819,6 @@ void Mob::InterruptSpell(uint16 message, uint16 color, uint16 spellid)
CastToNPC()->AI_Event_SpellCastFinished(false, casting_spell_slot);
}
if(casting_spell_type == 1 && IsClient()) { //Rest AA Timer on failed cast
CastToClient()->SendAlternateAdvancementTimer(casting_spell_timer - pTimerAAStart, 0, -1);
CastToClient()->Message_StringID(15, ABILITY_FAILED);
CastToClient()->GetPTimers().Clear(&database, casting_spell_timer);
}
ZeroCastingVars(); // resets all the state keeping stuff
Log.Out(Logs::Detail, Logs::Spells, "Spell %d has been interrupted.", spellid);
@ -2282,6 +2276,9 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16
//aa new todo: aa expendable charges here
CastToClient()->GetPTimers().Start(casting_spell_timer, casting_spell_timer_duration);
Log.Out(Logs::Detail, Logs::Spells, "Spell %d: Setting custom reuse timer %d to %d", spell_id, casting_spell_timer, casting_spell_timer_duration);
if(casting_spell_aa_id) {
CastToClient()->SendAlternateAdvancementTimer(casting_spell_timer - pTimerAAStart, 0, 0);
}
}
else if(spells[spell_id].recast_time > 1000 && !spells[spell_id].IsDisciplineBuff) {
int recast = spells[spell_id].recast_time/1000;