Example #1
0
        void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
        {
            PreventDefaultAction();

            HealInfo healInfo = eventInfo.GetHealInfo();

            if (healInfo == null || healInfo.GetHeal() == 0)
            {
                return;
            }

            SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(SpellIds.ChainedHeal, GetCastDifficulty());
            int       amount    = (int)MathFunctions.CalculatePct(healInfo.GetHeal(), aurEff.GetAmount());

            amount /= (int)spellInfo.GetMaxTicks();

            // Add remaining ticks to healing done
            Unit caster = eventInfo.GetActor();
            Unit target = eventInfo.GetProcTarget();

            amount += (int)target.GetRemainingPeriodicAmount(caster.GetGUID(), SpellIds.ChainedHeal, AuraType.PeriodicHeal);

            CastSpellExtraArgs args = new(aurEff);

            args.AddSpellMod(SpellValueMod.BasePoint0, amount);
            caster.CastSpell(target, SpellIds.ChainedHeal, args);
        }
Example #2
0
        void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
        {
            PreventDefaultAction();

            HealInfo healInfo = eventInfo.GetHealInfo();

            if (healInfo == null || healInfo.GetHeal() == 0)
            {
                return;
            }

            int absorb = (int)MathFunctions.CalculatePct(healInfo.GetHeal(), aurEff.GetAmount());

            // Multiple effects stack, so let's try to find this aura.
            AuraEffect aegis = eventInfo.GetProcTarget().GetAuraEffect(SpellIds.DivineAegis, 0);

            if (aegis != null)
            {
                absorb += aegis.GetAmount();
            }

            absorb = (int)Math.Min(absorb, eventInfo.GetProcTarget().getLevel() * 125);

            GetTarget().CastCustomSpell(SpellIds.DivineAegis, SpellValueMod.BasePoint0, absorb, eventInfo.GetProcTarget(), true, null, aurEff);
        }
Example #3
0
        bool CheckProc(ProcEventInfo eventInfo)
        {
            SpellInfo spellInfo = eventInfo.GetSpellInfo();

            if (spellInfo == null || spellInfo.Id == SpellIds.RejuvenationT10Proc)
            {
                return(false);
            }

            HealInfo healInfo = eventInfo.GetHealInfo();

            if (healInfo == null || healInfo.GetHeal() == 0)
            {
                return(false);
            }

            Player caster = eventInfo.GetActor().ToPlayer();

            if (!caster)
            {
                return(false);
            }

            return(caster.GetGroup() || caster != eventInfo.GetProcTarget());
        }
Example #4
0
        void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
        {
            PreventDefaultAction();

            HealInfo healInfo = eventInfo.GetHealInfo();

            if (healInfo == null || healInfo.GetHeal() == 0)
            {
                return;
            }

            uint heal = MathFunctions.CalculatePct(healInfo.GetHeal(), aurEff.GetAmount());

            var auras = GetCaster().GetSingleCastAuras();

            foreach (var eff in auras)
            {
                if (eff.GetId() == SpellIds.BeaconOfLight)
                {
                    List <AuraApplication> applications = eff.GetApplicationList();
                    if (!applications.Empty())
                    {
                        eventInfo.GetActor().CastCustomSpell(SpellIds.BeaconOfLightHeal, SpellValueMod.BasePoint0, (int)heal, applications.First().GetTarget(), true);
                    }
                    return;
                }
            }
        }
Example #5
0
    public override void Resolve()
    {
        HealInfo healInfo = new HealInfo(castInfo.holder, castInfo.target, heal);

        castInfo.target.stats.DoHeal(healInfo);
        castInfo.holder.hand.RemoveCard(cardHolder);
        cardHolder.player.mana -= cardHolder.card.info.cost;
    }
 public void Step(ref HealInfo token, int condition)
 {
     switch (condition)
     {
     case HealCondition.HealthBonus:
         OnHealEvent(token);
         break;
     }
 }
Example #7
0
 private void PlayHeal(HealInfo info)
 {
     if (!healthSlider)
     {
         UpdateHealthValues();
     }
     if (HealthUpdateCoroutine != null)
     {
         StopCoroutine(HealthUpdateCoroutine);
     }
     StartCoroutine(HealthUpdateCoroutine = OnHeal());
 }
Example #8
0
        public void Step(ref HealInfo heal, int condition)
        {
            // Heal Sequence Step
            var entityView      = entityViewsDB.QueryEntityView <HealthEntityView>(heal.entityHealID);
            var healthComponent = entityView.healthComponent;

            // Limit the heal to the max health of the player
            healthComponent.currentHealth = (heal.healAmmount + healthComponent.currentHealth > healthComponent.maxHealth)
                                                                                        ? healthComponent.maxHealth
                                                                                        : healthComponent.currentHealth + heal.healAmmount;

            _healSequence.Next(this, ref heal, HealCondition.HealthBonus);
        }
        void OnHealEvent(HealInfo healed)
        {
            var hudEntityViews = entityViewsDB.QueryEntityViews <HUDEntityView>();

            for (int i = 0; i < hudEntityViews.Count; i++)
            {
                var guiEntityView = hudEntityViews[i];

                var hudDamageEntityView =
                    entityViewsDB.QueryEntityView <HUDDamageEntityView>(healed.entityHealID);

                guiEntityView.healthSliderComponent.value = hudDamageEntityView.healthComponent.currentHealth;
            }
        }
Example #10
0
 public ProcEventInfo(Unit actor, Unit actionTarget, Unit procTarget, ProcFlags typeMask, ProcFlagsSpellType spellTypeMask,
                      ProcFlagsSpellPhase spellPhaseMask, ProcFlagsHit hitMask, Spell spell, DamageInfo damageInfo, HealInfo healInfo)
 {
     _actor          = actor;
     _actionTarget   = actionTarget;
     _procTarget     = procTarget;
     _typeMask       = typeMask;
     _spellTypeMask  = spellTypeMask;
     _spellPhaseMask = spellPhaseMask;
     _hitMask        = hitMask;
     _spell          = spell;
     _damageInfo     = damageInfo;
     _healInfo       = healInfo;
 }
Example #11
0
        void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
        {
            PreventDefaultAction();

            HealInfo healInfo = eventInfo.GetHealInfo();

            if (healInfo == null || healInfo.GetHeal() == 0)
            {
                return;
            }

            SpellInfo triggeredSpellInfo = Global.SpellMgr.GetSpellInfo(SpellIds.GlyphOfPrayerOfHealingHeal);
            int       heal = (int)(MathFunctions.CalculatePct(healInfo.GetHeal(), aurEff.GetAmount()) / triggeredSpellInfo.GetMaxTicks(Difficulty.None));

            GetTarget().CastCustomSpell(SpellIds.GlyphOfPrayerOfHealingHeal, SpellValueMod.BasePoint0, heal, eventInfo.GetProcTarget(), true, null, aurEff);
        }
Example #12
0
        bool CheckProc(ProcEventInfo eventInfo)
        {
            HealInfo healInfo = eventInfo.GetHealInfo();

            if (healInfo != null)
            {
                Unit healTarget = healInfo.GetTarget();
                if (healTarget)
                {
                    // @todo: fix me later if (healInfo.GetEffectiveHeal())
                    if (healTarget.GetHealth() >= healTarget.GetMaxHealth())
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
Example #13
0
        void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
        {
            PreventDefaultAction();
            Unit caster = eventInfo.GetActor();

            if (caster == eventInfo.GetProcTarget())
            {
                return;
            }

            HealInfo healInfo = eventInfo.GetHealInfo();

            if (healInfo == null || healInfo.GetHeal() == 0)
            {
                return;
            }

            int amount = (int)MathFunctions.CalculatePct(healInfo.GetHeal(), 10);

            caster.CastCustomSpell(SpellIds.OracularHeal, SpellValueMod.BasePoint0, amount, caster, true);
        }
        IEnumerator UpdateTick(int spawnerID)
        {
            while (true)
            {
                var playerMedkitEntityView = _playerMedkitEntityViews[spawnerID];

                if (playerMedkitEntityView == null)
                {
                    yield return(null);
                }

                var playerMedkitComponent = playerMedkitEntityView.playerMedkitComponent;
                var healthSliderComponent = _hudEntityView.healthSliderComponent;


                if (playerMedkitComponent.colided)
                {
                    var entityView            = entityViewsDB.QueryEntityView <HealthEntityView>(playerMedkitComponent.instanceID);
                    var playerHealthComponent = entityView.healthComponent;

                    // Don't destroy the health pack and don't heal the player if he is full hp

                    if (playerHealthComponent.currentHealth < playerHealthComponent.maxHealth)
                    {
                        var healInfo = new HealInfo(playerMedkitComponent.healthBonus, playerMedkitComponent.instanceID);
                        _playerHealSequence.Next(this, ref healInfo);

                        playerMedkitComponent.DestroyBox();

                        var pickupInfo = new PickupInfo(playerMedkitComponent.id, SpawnerTypes.Medkit);
                        _playerPickupSequence.Next(this, ref pickupInfo);
                    }

                    playerMedkitComponent.colided = false;
                }

                yield return(null);
            }
        }
Example #15
0
        void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
        {
            PreventDefaultAction();
            Unit caster = eventInfo.GetActor();

            if (caster == eventInfo.GetProcTarget())
            {
                return;
            }

            HealInfo healInfo = eventInfo.GetHealInfo();

            if (healInfo == null || healInfo.GetHeal() == 0)
            {
                return;
            }

            CastSpellExtraArgs args = new(aurEff);

            args.AddSpellMod(SpellValueMod.BasePoint0, (int)MathFunctions.CalculatePct(healInfo.GetHeal(), 10));
            caster.CastSpell(caster, SpellIds.OracularHeal, args);
        }
Example #16
0
        void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
        {
            PreventDefaultAction();

            HealInfo healInfo = eventInfo.GetHealInfo();

            if (healInfo == null || healInfo.GetHeal() == 0)
            {
                return;
            }

            Unit caster = eventInfo.GetActor();
            Unit target = eventInfo.GetProcTarget();

            SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(SpellIds.HolyMending);
            int       amount    = (int)MathFunctions.CalculatePct(healInfo.GetHeal(), aurEff.GetAmount());

            amount /= (int)spellInfo.GetMaxTicks(Difficulty.None);
            // Add remaining ticks to damage done
            amount += (int)target.GetRemainingPeriodicAmount(caster.GetGUID(), SpellIds.HolyMending, AuraType.PeriodicHeal);

            caster.CastCustomSpell(SpellIds.HolyMending, SpellValueMod.BasePoint0, amount, target, true, null, aurEff);
        }
Example #17
0
        void HandleProc(AuraEffect aurEff, ProcEventInfo eventInfo)
        {
            PreventDefaultAction();

            HealInfo healInfo = eventInfo.GetHealInfo();

            if (healInfo == null || healInfo.GetHeal() == 0)
            {
                return;
            }

            Unit caster = eventInfo.GetActor();
            Unit target = eventInfo.GetProcTarget();

            SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(SpellIds.HolyMending, GetCastDifficulty());
            int       amount    = (int)MathFunctions.CalculatePct(healInfo.GetHeal(), aurEff.GetAmount());

            amount /= (int)spellInfo.GetMaxTicks();

            CastSpellExtraArgs args = new(aurEff);

            args.AddSpellMod(SpellValueMod.BasePoint0, amount);
            caster.CastSpell(target, SpellIds.HolyMending, args);
        }
        public TryHealInjuryGump(PlayerMobile viewer, Mobile injured, Injury injury, HealInfo info, HealTimer timer)
            : base(0, 0)
        {
            m_Viewer = viewer;
            m_Injured = injured;
            m_Injury = injury;
            m_Info = info;
            m_Timer = timer;
            if (!m_Timer.Running)
                m_Timer.Start();

            InitialSetup();
        }
            public static bool MeetsRequirements(PlayerMobile healer, Mobile injured, HealInfo info, Injury injury)
            {
                HealInjuryRequirements req = HealInjuryRequirements.GetRequirements(injury);

                int MOE = (healer.Feats.GetFeatLevel(FeatList.Surgery) > 2 ? 1 : 0); // Margin of error from having max Surgery.

                if (!(info.Cut >= req.Cut - MOE && info.Cut <= req.Cut + MOE))
                    return false;
                if (!(info.Sew >= req.Sew - MOE && info.Sew <= req.Sew + MOE))
                    return false;
                if (!(info.Heat >= req.Heat - MOE && info.Heat <= req.Heat + MOE))
                    return false;
                if (!(info.Cool >= req.Cool - MOE && info.Cool <= req.Cool + MOE))
                    return false;
                if (!(info.Bleed >= req.Bleed - MOE && info.Bleed <= req.Bleed + MOE))
                    return false;

                return true;
            }
            public HealTimer(PlayerMobile healer, Mobile injured, Injury injury, HealInfo info)
                : base(TimeSpan.Zero, TimeSpan.FromSeconds(1))
            {
                m_Healer = healer;
                m_Injured = injured;
                m_Injury = injury;
                m_HealInfo = info;

                int medVal = 15;
                if (healer != null && !healer.Deleted & healer.Alive)
                {
                    medVal += (healer.Feats.GetFeatLevel(FeatList.Medicine) * 5);
                    medVal += (healer.Feats.GetFeatLevel(FeatList.Surgery) * 10);
                }

                if(injured != null && !injured.Deleted && injured.Alive)
                    medVal += injured.Stam / 10;

                m_StartTime = DateTime.Now;
                m_Expiration = DateTime.Now.AddSeconds(medVal);
            }
Example #21
0
 public void DoHeal(HealInfo info)
 {
     m_health += info.count;
     m_health  = Mathf.Clamp(m_health, 0, maxHealth);
     OnHeal.Invoke(info);
 }
 public TryHealInjuryGump(PlayerMobile viewer, Mobile injured, Injury injury, HealInfo info)
     : this(viewer, injured, injury, info, new HealTimer(viewer, injured, injury, info))
 {
 }
 public SewTarget(Mobile injured, Injury injury, HealInfo info, HealTimer timer)
     : base(1, true, TargetFlags.None)
 {
     m_Injured = injured;
     m_Injury = injury;
     m_Info = info;
     m_Timer = timer;
 }