SpellCastResult CheckCast() { Player* caster = GetCaster()->ToPlayer(); if (GetTargetUnit()) if (Unit* target = GetTargetUnit()) if (!caster->IsFriendlyTo(target) && !caster->IsValidAttackTarget(target)) return SPELL_FAILED_BAD_TARGETS; return SPELL_CAST_OK; }
SpellCastResult CheckCast() { Player* caster = GetCaster()->ToPlayer(); if (GetTargetUnit()) if (Player* target = GetTargetUnit()->ToPlayer()) if (caster->GetTeam() != target->GetTeam() && !caster->IsValidAttackTarget(target)) return SPELL_FAILED_BAD_TARGETS; return SPELL_CAST_OK; }
void CheckTarget(SpellEffIndex effIndex) { PreventHitDefaultEffect(EFFECT_0); if (!GetTargetUnit()) return; uint32 triggered_spell_id = GetSpellInfo()->Effects[effIndex].TriggerSpell; // let Rotface handle the cast - caster dies before this executes if (InstanceScript* script = GetTargetUnit()->GetInstanceScript()) if (Creature* rotface = script->instance->GetCreature(script->GetData64(DATA_ROTFACE))) rotface->CastSpell(GetTargetUnit(), triggered_spell_id, true, NULL, NULL, GetCaster()->GetGUID()); }
SpellCastResult CheckCast() { Player* caster = GetCaster()->ToPlayer(); if (GetTargetUnit()) if (Player* target = GetTargetUnit()->ToPlayer()) // Fix Penance after Mind Control in arena, // probably bugged because of the crossfaction script if (caster->GetOTeam() != target->GetOTeam() && !caster->IsValidAttackTarget(target) // AllowTwoSide.Interaction.Group will break this spell so // set friendly also players in your party or raid group && !caster->IsInRaidWith(target)) return SPELL_FAILED_BAD_TARGETS; return SPELL_CAST_OK; }
void FilterTargets(std::list<Unit*>& unitList) { if (!GetCaster()->ToPlayer()->GetGroup()) { unitList.clear(); unitList.push_back(GetCaster()); } else { unitList.remove(GetTargetUnit()); std::list<Unit*> tempTargets; for (std::list<Unit*>::const_iterator itr = unitList.begin(); itr != unitList.end(); ++itr) if ((*itr)->GetTypeId() == TYPEID_PLAYER && GetCaster()->IsInRaidWith(*itr)) tempTargets.push_back(*itr); if (tempTargets.empty()) { unitList.clear(); FinishCast(SPELL_FAILED_DONT_REPORT); return; } Unit* target = SelectRandomContainerElement(tempTargets); unitList.clear(); unitList.push_back(target); } }
void FilterTargets(std::list<Unit*>& unitList) { if (!GetCaster()->ToPlayer()->GetGroup()) { unitList.clear(); unitList.push_back(GetCaster()); } else { unitList.remove(GetTargetUnit()); std::list<Unit*> tempTargets; for (std::list<Unit*>::const_iterator itr = unitList.begin(); itr != unitList.end(); ++itr) if ((*itr)->GetTypeId() == TYPEID_PLAYER && GetCaster()->IsInRaidWith(*itr)) tempTargets.push_back(*itr); if (tempTargets.empty()) { unitList.clear(); FinishCast(SPELL_FAILED_DONT_REPORT); return; } std::list<Unit*>::const_iterator it2 = tempTargets.begin(); std::advance(it2, urand(0, tempTargets.size() - 1)); unitList.clear(); unitList.push_back(*it2); } }
void HandleDummy(SpellEffIndex /*effIndex*/) { if (Unit* target = GetTargetUnit()) if (target->GetTypeId() == TYPEID_UNIT && target->HasAura(SPELL_FORCE_SHIELD_ARCANE_PURPLE_X3)) // Make sure nobody else is channeling the same target if (!target->HasAura(SPELL_SCOURGING_CRYSTAL_CONTROLLER)) GetCaster()->CastSpell(target, SPELL_SCOURGING_CRYSTAL_CONTROLLER, true, GetCastItem()); }
void HandleForceCast(SpellEffIndex i) { Player * plr = GetHitPlayer(); if (!plr) return; plr->CastSpell(GetTargetUnit(), GetSpellInfo()->EffectTriggerSpell[i], true); // Don't send m_originalCasterGUID param here or underlying PreventHitEffect(i); // AureEffect::HandleAuraControlVehicle will fail on caster == target }
void HandleScript(SpellEffIndex /*eff*/) { Unit* target = GetTargetUnit(); if (!target) return; target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); target->SetByteValue(UNIT_FIELD_BYTES_1, 0, UNIT_STAND_STATE_STAND); }
SpellCastResult CheckTarget() { Unit* target = GetTargetUnit(); if(!target) return SPELL_FAILED_BAD_TARGETS; if(target->GetEntry() == NPC_OZZIE_TOGGLEVOLT || target->GetEntry() == NPC_MILLI_FEATHERWHISTLE || target->GetEntry() == NPC_TOG_RUSTSPROCKET) return SPELL_CAST_OK; return SPELL_FAILED_BAD_TARGETS; }
SpellCastResult CheckCast() { if (Player* caster = GetCaster()->ToPlayer()) { // Death Grip should not be castable while jumping/falling if (caster->HasUnitState(UNIT_STATE_JUMPING) || caster->HasUnitMovementFlag(MOVEMENTFLAG_FALLING)) return SPELL_FAILED_MOVING; float x = GetTargetUnit()->GetPositionX(); float y = GetTargetUnit()->GetPositionY(); float z = GetTargetUnit()->GetPositionZ(); // Death Grip's minimum range set to 8 yards in PvE if (GetTargetUnit()->GetTypeId() != TYPEID_PLAYER) if (caster->GetDistance(x, y, z) < 8) return SPELL_FAILED_TOO_CLOSE; } return SPELL_CAST_OK; }
SpellCastResult CheckTarget() { Unit* target = GetTargetUnit(); if(!target || target->GetTypeId() != TYPEID_PLAYER || target->isAlive()) return SPELL_FAILED_BAD_TARGETS; else if(GetCaster()->ToPlayer()->InArena()) return SPELL_FAILED_NOT_IN_ARENA; return SPELL_CAST_OK; }
SpellCastResult CheckRequirement() { if (!GetCaster()->HasAura(GetSpellInfo()->Effects[EFFECT_1].CalcValue())) return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW; // This is actually correct if (!GetTargetUnit()) return SPELL_FAILED_BAD_TARGETS; return SPELL_CAST_OK; }
SpellCastResult CheckTarget() { if (IsVampire(GetTargetUnit())) { SetCustomCastResultMessage(SPELL_CUSTOM_ERROR_CANT_TARGET_VAMPIRES); return SPELL_FAILED_CUSTOM_ERROR; } return SPELL_CAST_OK; }
SpellCastResult CheckRequirement() { if(!GetCaster()->HasAura(SpellMgr::CalculateSpellEffectAmount(GetSpellInfo(), EFFECT_1))) return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW; // This is actually correct if(!GetTargetUnit()) return SPELL_FAILED_BAD_TARGETS; return SPELL_CAST_OK; }
void HandleTriggerMissile(SpellEffIndex effIndex) { PreventHitDefaultEffect(effIndex); Unit* caster = GetCaster(); Unit* target = GetTargetUnit(); if (caster && target) { uint32 id = uint32(caster->GetMap()->GetDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL ? 61912 : 63494); caster->CastSpell(target, id, true); } }
void HandleOnHit() { std::list<Unit*> players; std::list<Unit*>::const_iterator itr; GetTargetUnit()->GetRaidMember(players,5.0f); for(itr=players.begin();itr!=players.end();++itr) { if((*itr)->GetTypeId() == TYPEID_PLAYER) { GetCaster()->CastSpell((*itr),SPELL_DESTRUCTION_PROCS,false); } } }
void FilterTargets(std::list<Unit*>& unitList) { unitList.remove(GetTargetUnit()); std::list<Unit*> tempTargets; std::list<Unit*>::iterator end = unitList.end(), itr = unitList.begin(); for (; itr != end; ++itr) if (GetCaster()->IsInRaidWith(*itr)) tempTargets.push_back(*itr); itr = tempTargets.begin(); std::advance(itr, urand(0, tempTargets.size()-1)); unitList.clear(); unitList.push_back(*itr); }
void HandleScriptEffect(SpellEffIndex /*effIndex*/) { if (Unit * target = GetHitUnit()) { target->CastSpell(target, GetEffectValue(), true); target->CastSpell(target, HUNTER_SPELL_MASTERS_CALL_TRIGGERED, true); // there is a possibility that this effect should access effect 0 (dummy) target, but i dubt that // it's more likely that on on retail it's possible to call target selector based on dbc values // anyways, we're using GetTargetUnit() here and it's ok if (Unit * ally = GetTargetUnit()) { target->CastSpell(ally, GetEffectValue(), true); target->CastSpell(ally, SpellMgr::CalculateSpellEffectAmount(GetSpellInfo(), EFFECT_0), true); } } }
void HandleScriptEffect(SpellEffIndex /*effIndex*/) { if (Unit* target = GetHitUnit()) { // Cannot be processed while pet is dead TriggerCastFlags castMask = TriggerCastFlags(TRIGGERED_FULL_MASK & ~TRIGGERED_IGNORE_CASTER_AURASTATE); target->CastSpell(target, GetEffectValue(), castMask); target->CastSpell(target, HUNTER_SPELL_MASTERS_CALL_TRIGGERED, castMask); // there is a possibility that this effect should access effect 0 (dummy) target, but i dubt that // it's more likely that on on retail it's possible to call target selector based on dbc values // anyways, we're using GetTargetUnit() here and it's ok if (Unit* ally = GetTargetUnit()) { target->CastSpell(ally, GetEffectValue(), castMask); target->CastSpell(ally, GetSpellInfo()->Effects[EFFECT_0].CalcValue(), castMask); } } }
void FilterTargets(std::list<Unit*>& unitList) { totalTargets = NULL; for (std::list<Unit*>::iterator itr = unitList.begin() ; itr != unitList.end(); ++itr) { Unit *target = (*itr); if (!target) continue; if (!target->IsWithinDist(GetTargetUnit(), 10.0f)) { unitList.remove(target); continue; } totalTargets++; } }
SpellCastResult CheckCast() { if (Player* caster = GetCaster()->ToPlayer()) { if (Pet* pet = caster->GetPet()) { if (!pet->isAlive()) return SPELL_FAILED_NO_PET; if (pet->HasUnitState(UNIT_STATE_STUNNED) || caster->HasUnitState(UNIT_STATE_STUNNED)) return SPELL_FAILED_STUNNED; if (!pet->IsWithinLOS(caster->GetPositionX(), caster->GetPositionY(), caster->GetPositionZ())) return SPELL_FAILED_LINE_OF_SIGHT; if (Unit* target = GetTargetUnit()) { if (!pet->IsWithinLOS(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ())) return SPELL_FAILED_LINE_OF_SIGHT; } } } return SPELL_CAST_OK; }
void FilterTargets(std::list<Unit*>& unitList) { unitList.remove(GetTargetUnit()); }
void HandleScriptEffect(SpellEffIndex /*effIndex*/) { if (Unit* target = GetTargetUnit()) if (urand(0, 99) < 15) target->CastSpell(target, spellId, true); }
void HandleDummy(SpellEffIndex effIndex) { GetCaster()->CastSpell(GetTargetUnit(),spell_trigger,false); }