public TrinitySpell(Unit caster, TrinitySpellInfo info, TriggerCastFlags triggerFlags, Guid originalCasterId, bool skipCheck = false)
    {
        SpellValue = new SpellValue(info);

        Caster    = caster;
        SpellInfo = info;

        CastId         = Guid.NewGuid();
        OriginalCastId = CastId;
        SkipCheck      = skipCheck;

        ExecutedCurrently          = false;
        ApplyMultiplierMask        = 0;
        DamageMultipliers          = new float[3];
        ReferencedFromCurrentSpell = false;

        SpellSchoolMask = SpellInfo.SchoolMask;

        if (originalCasterId != Guid.Empty)
        {
            OriginalCasterGuid = originalCasterId;
        }
        else
        {
            OriginalCasterGuid = caster.Character.Id;
        }

        if (OriginalCasterGuid == caster.Character.Id)
        {
            OriginalCaster = caster;
        }
        else
        {
            OriginalCaster = ArenaManager.ArenaUnits.Find(unit => unit.Character.Id == OriginalCasterGuid);
        }

        SpellState       = SpellState.NONE;
        TriggerCastFlags = triggerFlags;

        UnitTarget       = null;
        DestTarget       = null;
        Damage           = 0;
        Variance         = 0.0f;
        EffectHandleMode = SpellEffectHandleMode.LAUNCH;
        EffectInfo       = null;

        DiminishLevel = DiminishingLevels.LEVEL_1;
        DiminishGroup = DiminishingGroup.NONE;

        EffectDamage  = 0;
        EffectHealing = 0;
        SpellAura     = null;

        SpellVisual = SpellInfo.VisualId;
        CanReflect  = SpellInfo.DamageClass == SpellDamageClass.MAGIC && !SpellInfo.HasAttribute(SpellAttributes.CANT_BE_REFLECTED) &&
                      !SpellInfo.IsPassive() && !SpellInfo.IsPositive();

        UniqueTargets = new List <TargetInfo>();
        SpellEffects  = new List <TrinitySpellEffectInfo>(SpellInfo.SpellEffectInfos);
    }
Пример #2
0
    public SpellMissInfo SpellHitResult(Unit victim, TrinitySpellInfo spellInfo, bool canReflect)
    {
        // Check for immune

        /*if (victim->IsImmunedToSpell(spellInfo))
         *  return SPELL_MISS_IMMUNE;*/

        // All positive spells can`t miss
        /// @todo client not show miss log for this spells - so need find info for this in dbc and use it!
        if (spellInfo.IsPositive() && !IsHostileTo(victim)) // prevent from affecting enemy by "positive" spell
        {
            return(SpellMissInfo.NONE);
        }

        // Check for immune

        /*if (victim->IsImmunedToDamage(spellInfo))
         *  return SPELL_MISS_IMMUNE;*/

        if (this == victim)
        {
            return(SpellMissInfo.NONE);
        }

        // Try victim reflect spell

        /*if (CanReflect)
         * {
         *  int32 reflectchance = victim->GetTotalAuraModifier(SPELL_AURA_REFLECT_SPELLS);
         *      Unit::AuraEffectList const& mReflectSpellsSchool = victim->GetAuraEffectsByType(SPELL_AURA_REFLECT_SPELLS_SCHOOL);
         *  for (Unit::AuraEffectList::const_iterator i = mReflectSpellsSchool.begin(); i != mReflectSpellsSchool.end(); ++i)
         *      if ((*i)->GetMiscValue() & spellInfo->GetSchoolMask())
         *          reflectchance += (*i)->GetAmount();
         *  if (reflectchance > 0 && roll_chance_i(reflectchance))
         *  {
         *      // Start triggers for remove charges if need (trigger only for victim, and mark as active spell)
         *      ProcDamageAndSpell(victim, PROC_FLAG_NONE, PROC_FLAG_TAKEN_SPELL_MAGIC_DMG_CLASS_NEG, PROC_EX_REFLECT, 1, BASE_ATTACK, spellInfo);
         *      return SPELL_MISS_REFLECT;
         *  }
         * }*/

        /*switch (spellInfo->DmgClass)
         * {
         *  case SPELL_DAMAGE_CLASS_RANGED:
         *  case SPELL_DAMAGE_CLASS_MELEE:
         *      return MeleeSpellHitResult(victim, spellInfo);
         *  case SPELL_DAMAGE_CLASS_NONE:
         *      return SPELL_MISS_NONE;
         *  case SPELL_DAMAGE_CLASS_MAGIC:
         *      return MagicSpellHitResult(victim, spellInfo);
         * }*/
        return(SpellMissInfo.NONE);
    }