Inheritance: MonoBehaviour
Ejemplo n.º 1
0
        private void HandleCollision(GameObject otherObject)
        {
            // make sure that we should be sending messages to it
            if (otherObject.GetComponent <NoMessagesBehavior>() != null)
            {
                return;
            }

            switch (Type)
            {
            case PayloadType.GeneralDamage:
                otherObject.SendSignal(AllSignals.Damage, new Damage(Amount));
                DestroyOwner();
                break;

            case PayloadType.Health:
                var healing = new Healing(Amount);
                otherObject.SendSignal(AllSignals.Health, healing);

                if (healing.Remaining <= 0)
                {
                    DestroyOwner();
                }
                break;

            case PayloadType.Money:
                // TODO move towards target
                bool wasHandled = otherObject.SendSignal(AllSignals.MoneyTransfer, new MoneyTransfer(Amount));
                if (wasHandled)
                {
                    DestroyOwner();
                }
                break;
            }
        }
Ejemplo n.º 2
0
    //Have a constructor that just accepts a premade Healing instance and copies it
    public ExecHeal(Chr _chrSource, Chr _chrTarget, Healing _heal) : base(_chrSource, _chrTarget)
    {
        heal = new Healing(_heal);

        heal.chrSource = _chrSource;
        heal.chrTarget = _chrTarget;
    }
Ejemplo n.º 3
0
        public async Task <bool> HandOfTheProtectordMethod()
        {
            if (!Paladin.Settings.PaladinSettings.Instance.UseLightOfTheProtector)
            {
                return(false);
            }

            var spell = LightOfTheProtector;

            if (MyTalents.HandOfTheProtector.IsActive())
            {
                spell = HandOfTheProtector;
            }

            if (spell.CRSpell.Cooldown)
            {
                return(false);
            }

            if (Globals.MyHp < Paladin.Settings.PaladinSettings.Instance.LightOfTheProtector)
            {
                return(await CastHandOfTheProtector(StyxWoW.Me, spell));
            }

            var target = Healing.HealTarget(Paladin.Settings.PaladinSettings.Instance.LightOfTheProtectorOther);

            if (target == null)
            {
                return(false);
            }

            return(await CastHandOfTheProtector(target, spell));
        }
Ejemplo n.º 4
0
        public void Heal()
        {
            Healing healing = new Healing(_distribution);

            Logger.LogAction(_id, _id, healing);
            Hp += healing.GetValue();
        }
Ejemplo n.º 5
0
    private Healing CalculateHealing(int minh, int maxh, float critchance, HEALTYPE healtype)
    {
        int  value  = 0;
        bool isCrit = false;

        if (minh != maxh)
        {
            value = Random.Range(minh, maxh);
        }
        else
        {
            value = minh;
        }
        if (critchance > 0)
        {
            if (Random.Range(0, 100) < critchance)
            {
                value *= 2;
                isCrit = true;
            }
        }

        Healing myHeal = new Healing(value, isCrit, healtype);

        return(myHeal);
    }
Ejemplo n.º 6
0
    private Healing ApplyHealingModifiersBySource(Healing baseHealing, Caster caster, HEALSOURCE source)
    {
        Healing newHealing = baseHealing;

        if (source == HEALSOURCE.SCROLL_OF_RENEW)
        {
            newHealing.value = (int)(maxHealth * 0.5f);
            return(newHealing);
        }

        if (source == HEALSOURCE.SHADOWSONG)
        {
            if (caster.myTalentTree.GetTalentByName("Shadowmend").Points > 0)
            {
                Buff myb = effectSystem.FindBuff((int)Buff.DB.SOOTHING_VOID);
                if (myb != null)
                {
                    newHealing.value = (int)(newHealing.value + newHealing.value * caster.myTalentTree.GetTalentByName("Shadowmend").Points * 0.2f);
                    return(newHealing);
                }
            }
        }

        return(newHealing);
    }
Ejemplo n.º 7
0
    private Healing ApplyHealingModifiersByBuff(HEALSOURCE source, Healing baseHeal, Caster _caster)
    {
        Healing newHealing = baseHeal;

        if (source == HEALSOURCE.WOK_LIGHT)
        {
            Buff _myb = soldier.effectSystem.FindBuff(BUFF.FAITH);
            if ((_myb != null))
            {
                SpellInfo spellInfo = GameCore.Core.spellRepository.Get(SPELL.WORD_OF_KINGS_FAITH);
                int       _dur      = spellInfo.ticksCount * spellInfo.HoTgap;
                int       _gap      = spellInfo.HoTgap;
                GameCore.Core.paladinSparkHandler.AddSparks(1);
                soldier.effectSystem.BuffMe(BUFF.WORD_OF_KINGS_FAITH, _dur, _caster, spellInfo, _gap);
            }

            CasterBuff _casterBuff = GameCore.Core.buffSystem.FindBuff(CASTERBUFF.DIVINE_INTERVENTION);
            if (baseHeal.isCrit)
            {
                if (_casterBuff != null)
                {
                    baseHeal.value = (int)((float)baseHeal.value * (1f + (float)_caster.GetFocus() / 100f));
                }
            }
        }



        return(newHealing);
    }
Ejemplo n.º 8
0
        public async Task <bool> LayOnHandsMethod()
        {
            // TODO unify methods
            if (LayOnHands.CRSpell.Cooldown)
            {
                return(false);
            }

            if (PaladinSettings.Instance.ProtLoHUseOnSelf && !Globals.Forbearance && Globals.MyHp <= PaladinSettings.Instance.ProtLoHUseHp)
            {
                return(await CastLayOnHands(StyxWoW.Me));
            }

            if (!PaladinSettings.Instance.ProtLoHUse || !Globals.InParty)
            {
                return(false);
            }

            // Unit.LayOnHandsTarget already does the checks for tank/healer etc
            var target = Healing.LayOnHandsTarget(PaladinSettings.Instance.ProtLoHUseHp);

            if (target == null || target.IsDead)
            {
                return(false);
            }

            Helpers.Logger.DiagnosticLog("Lay on Hands on {0}, Distance: {1}, LOS: {2}", target.SafeName, target.Distance, target.InLineOfSpellSight);

            return(await CastLayOnHands(target));
        }
Ejemplo n.º 9
0
        public async Task <bool> BlessingOfSanctuaryMethod()
        {
            // TODO focus target
            if (!Helpers.Globals.Arena)
            {
                return(false);
            }

            if (!Styx.CommonBot.SpellManager.HasSpell(BlessingOfSanctuary.ID))
            {
                return(false);
            }

            var target = Healing.BlessingOfSanctuaryTarget();

            if (target == null)
            {
                return(false);
            }

            Helpers.Logger.DiagnosticLog("Blessing of Sanctuary on {0}, Distance: {1}, LOS: {2}", target.SafeName, target.Distance, target.InLineOfSpellSight);

            if (!await BlessingOfSanctuary.Cast(target))
            {
                return(false);
            }

            LastSpell = BlessingOfSanctuary;
            return(true);
        }
Ejemplo n.º 10
0
        public async Task <bool> LightOfDawnMethod()
        {
            if (StyxWoW.Me.IsMoving)
            {
                return(false);
            }

            if (!Globals.InParty)
            {
                return(false);
            }

            if (!Healing.CastLightOfDawn(PaladinSettings.Instance.LightOfDawnHP))
            {
                return(false);
            }

            if (!await LightOfDawn.Cast(StyxWoW.Me))
            {
                return(false);
            }

            LastSpell = LightOfDawn;
            return(true);
        }
Ejemplo n.º 11
0
        public Skill CreateSkill(Player player)
        {
            List <Skill> playerSkills = player.ListOfSkills;
            Skill        known        = CheckContent(playerSkills);

            if (known == null)
            {
                Healing          s1 = new Healing();
                StrengthTheft    s2 = new StrengthTheft();
                ArmorDestruction s3 = new ArmorDestruction();

                List <Skill> tmp = new List <Skill>();
                if (s1.MinimumLevel <= player.Level)
                {
                    tmp.Add(s1);                                  // check level requirements
                }
                if (s2.MinimumLevel <= player.Level)
                {
                    tmp.Add(s2);
                }
                if (s3.MinimumLevel <= player.Level)
                {
                    tmp.Add(s3);
                }
                if (tmp.Count == 0)
                {
                    return(null);
                }
                return(tmp[Index.RNG(0, tmp.Count)]);
            }
            else if (known.decoratedSkill == null)
            {
                HealingDecorator          s1 = new HealingDecorator(known);
                StrengthTheftDecorator    s2 = new StrengthTheftDecorator(known);
                ArmorDestructionDecorator s3 = new ArmorDestructionDecorator(known);
                List <Skill> tmp             = new List <Skill>();
                if (s1.MinimumLevel <= player.Level)
                {
                    tmp.Add(s1);                                  // check level requirements
                }
                if (s2.MinimumLevel <= player.Level)
                {
                    tmp.Add(s2);
                }
                if (s3.MinimumLevel <= player.Level)
                {
                    tmp.Add(s3);
                }
                if (tmp.Count == 0)
                {
                    return(null);
                }
                return(tmp[Index.RNG(0, tmp.Count)]);
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 12
0
 private void OnHealFeedback(Healing hel, Unit unit)
 {
     healFeedbackHandlers.ForEach((e) => e.onHealFeedback(hel, unit));
     if (HealFeedbackListener != null)
     {
         HealFeedbackListener.Invoke(hel, unit);
     }
 }
Ejemplo n.º 13
0
 // Start is called before the first frame update
 void Start()
 {
     script       = GameObject.Find("Player").GetComponent <Healing>();
     script2      = zombieHips.GetComponent <MutantHealth>();
     anim         = zombie.GetComponent <Animator>();
     attackDamage = 25;
     attacking    = false;
 }
Ejemplo n.º 14
0
 private void OnHealModifier(Healing hel, Unit unit)
 {
     healModifierHandlers.ForEach((e) => e.onHealModifier(hel, unit));
     if (HealModifierListener != null)
     {
         HealModifierListener.Invoke(hel, unit);
     }
 }
Ejemplo n.º 15
0
    public void Execute()
    {
        int _value = 0;

        _value  = spellInfo.baseValue2 / spellInfo.ticksCount;
        _value += (int)(GameCore.Core.chosenAccount.statPWR * spellInfo.coeff2 / spellInfo.ticksCount);

        switch (ID)
        {
        case 0:
        {
            // no buff
        }
        break;

        case (int)Buff.DB.WORD_OF_KINGS_FAITH:
        {
            Healing temp = myParent.Heal((int)(_value * multiplier), (int)((_value + 6) * multiplier), GameCore.Core.criticalStrikeChance, myCaster, spellInfo, HEALSOURCE.WOK_FAITH, HEALTYPE.PERIODIC_SINGLE);
            if (temp.isCrit)
            {
                if (myCaster.myAura[(int)AURA.DIVINITY].isActive)
                {
                    myParent.Shield((int)(temp.value * VALUES.DIVINITY_PERCENT), HEALSOURCE.DIVNITY_SHIELD);
                }
            }
            if (temp.overhealing > 0)
            {
                if (myCaster.myAura[(int)AURA.EMPATHY].isActive)
                {
                    myParent.Shield((int)(temp.overhealing * VALUES.EMPATHY_PERCENT), HEALSOURCE.EMPATHY);
                }
            }
        }
        break;

        case (int)Buff.DB.SHADOWMEND:
        {
            myParent.Heal(minv, maxv, 0, myCaster, spellInfo, HEALSOURCE.SHADOWMEND, HEALTYPE.PERIODIC_MULTI);
        }
        break;

        case (int)Buff.DB.SOOTHING_VOID:
        {
            myParent.Heal(_value, _value, 0, myCaster, spellInfo, HEALSOURCE.SOOTHING_VOID, HEALTYPE.PERIODIC_SINGLE);
        }
        break;

        case (int)Buff.DB.TWILIGHT_BEAM:
        {
            float _pen = 1.5f - (multiplier * 0.1f);
            int   _val = (int)(_value * _pen);

            Healing _heal = myParent.Heal(_val, _val, GameCore.Core.criticalStrikeChance, myCaster, spellInfo, HEALSOURCE.TWILIGHT_BEAM, HEALTYPE.PERIODIC_SINGLE);
            multiplier += 1;
        }
        break;
        }
    }
Ejemplo n.º 16
0
 void DropLoot()
 {
     if (Random.Range(0f, 100f) <= 25)
     {
         heartDrop = Instantiate(heartDropPrefab);
         heartDrop.transform.position = transform.position;
         MonsterSpawner.hearts.Add(heartDrop);
     }
 }
Ejemplo n.º 17
0
 private void TakeHealing(Healing hel, Unit healer)
 {
     // -- 1
     this.OnHealModifier(hel, healer);
     // -- 2
     this.ChangeHp(hel.value);
     // -- 3
     this.OnHealFeedback(hel, healer);
 }
Ejemplo n.º 18
0
 private void CriticalHealTrigger(Healing myHeal)
 {
     if ((myHeal.healtype != HEALTYPE.PERIODIC_SINGLE) && (myHeal.healtype != HEALTYPE.PERIODIC_MULTI))
     {
         if (myHeal.isCrit)
         {
             core.CriticalHealOccured();
         }
     }
 }
Ejemplo n.º 19
0
    public override void Execute(Caster who, Soldier target, int minval = 0, int maxval = 0)
    {
        int       _value    = 0;
        SpellInfo spellInfo = GameCore.Core.spellRepository.Get(SPELL.SHADOWSONG);

        _value  = spellInfo.baseValue;
        _value += (int)(GameCore.Core.chosenAccount.statPWR * spellInfo.coeff);

        Healing _heal = target.Heal(_value, _value + 20, GameCore.Core.criticalStrikeChance, who, spellInfo, HEALSOURCE.SHADOWSONG, spellInfo.healtype);
    }
Ejemplo n.º 20
0
 void Awake()
 {
     if (instance != null)
     {
         Destroy(gameObject);
         return;
     }
     instance = this;
     DontDestroyOnLoad(gameObject);
     healingBar.value = 0.0f;
 }
Ejemplo n.º 21
0
        private void MaybeApplyVampirism(GameObject caster, Damage damage)
        {
            if (damage.Amount < 1 || Mathf.Approximately(this.Data.Vampirism, 0))
            {
                return;
            }

            var healing = new Healing(damage * this.Data.Vampirism, HealingFlags.Vampirism);

            caster.GetComponent <HealthComponent>().Heal(caster, healing);
        }
Ejemplo n.º 22
0
 /// <inheritdoc />
 private void Update(Entity entity,
                     ref Health health,
                     ref Healing healing)
 {
     // make sure we heal the given amount
     if (health.Hp < health.MaxHp)
     {
         int maxAmount = Math.Max(health.MaxHp - health.Hp, healing.HitPointsPerTick);
         health.Hp += maxAmount;
     }
 }
Ejemplo n.º 23
0
    public Healing(Healing healToCopy)
    {
        //Copy over all the attributes of the original Healing instance
        chrSource = healToCopy.chrSource;
        chrTarget = healToCopy.chrTarget;

        GetBase = healToCopy.GetBase;

        //Copy the Power fetch method too
        GetPower = healToCopy.GetPower;
    }
Ejemplo n.º 24
0
 // Start is called before the first frame update
 void Start()
 {
     taken       = false;
     healthBonus = false;
     ammoBonus   = false;
     Player      = GameObject.Find("Player");
     FPC         = GameObject.Find("Player/FirstPersonCharacter");
     script2     = Player.GetComponent <Healing>();
     GC          = GameObject.Find("GameController");
     script3     = FPC.GetComponent <ThrowGrenade>();
     script      = GC.GetComponent <GameController>();
 }
Ejemplo n.º 25
0
 private void WoKLoyaltyBeaconHealing(Healing myHeal, HEALSOURCE source, HEALTYPE healtype)
 {
     if ((GameCore.chosenChampion == CHAMPION.PALADIN) && (source != HEALSOURCE.WOK_LOYALTY) && (source != HEALSOURCE.GUIDANCE_OF_RAELA))
     {
         float perc = VALUES.WORD_OF_KINGS_LOYALTY_TRANSFER + core.myCaster.myAura[(int)AURA.SPIRIT_BOND].stacks * VALUES.SPIRIT_BOND_INCREASE;
         if ((core.myCaster.AuraActive(AURA.SPIRIT_BOND)) && ((healtype == HEALTYPE.DIRECT_MULTI) || (healtype == HEALTYPE.PERIODIC_MULTI)))
         {
             perc *= 0.3f;
         }
         core.BeaconHeal((int)(myHeal.value * perc), 4, soldier);
     }
 }
Ejemplo n.º 26
0
 // Start is called before the first frame update
 void Start()
 {
     Player = GameObject.Find("Player");
     script = Player.GetComponent <Healing>();
     StartCoroutine("countDown");
     secs  = time % 60;
     hours = Mathf.Floor(time / 60);
     if (10 > secs)
     {
         seconds = ("0" + secs);
     }
 }
Ejemplo n.º 27
0
    public void TakeHealing(Healing healToTake)
    {
        //Fetch the amount of healing we're going to take
        int nHealingToTake = healToTake.Get();

        //If there's healing to be done, then apply it to our health
        if (nHealingToTake > 0)
        {
            ChangeHealth(nHealingToTake);
        }

        //maybe notify people that we've been healed
    }
Ejemplo n.º 28
0
    public SoulSadism(Chr _chrSource, Chr _chrTarget, Skill _skillSource) : base(_chrSource, _chrTarget, _skillSource)
    {
        sName = "Sadism";

        bVisible           = false;
        bDuration          = false;
        bRecoilWhenApplied = false;

        nBaseHealing = 5;

        //Create a base Healing object that this skill will apply
        heal = new Healing(this.chrSource, this.chrSource, nBaseHealing);
    }
Ejemplo n.º 29
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="script"></param>
        public HealingControl(Healing script)
        {
            InitializeComponent();


            if (script != null)
            {
                Action = script;
            }
            else
            {
                Action = new Healing();
            }
        }
Ejemplo n.º 30
0
    private Healing ApplyHealingModifiersByBuff(HEALSOURCE source, Healing baseHeal)
    {
        Healing newHealing = baseHeal;
        Buff    _myb       = effectSystem.FindBuff((int)Buff.DB.FLASH_OF_FUTURE);

        if ((_myb != null) && (source == HEALSOURCE.WOK_LIGHT))
        {
            newHealing.value = (int)(newHealing.value * 1.5f);
            _myb.Remove();
            return(newHealing);
        }

        return(newHealing);
    }
Ejemplo n.º 31
0
	public static Healing getHealing(int id){
		
		Healing healing = new Healing ();
		healing.id = ItemsInventory_lvl2.healing_list [id].id;
		healing.name = ItemsInventory_lvl2.healing_list [id].name;
		healing.type = ItemsInventory_lvl2.healing_list [id].type;
		healing.VIT = ItemsInventory_lvl2.healing_list [id].VIT;
		healing.PM = ItemsInventory_lvl2.healing_list [id].PM;
		healing.FRZ = ItemsInventory_lvl2.healing_list [id].FRZ;
		healing.DEF = ItemsInventory_lvl2.healing_list [id].DEF;
		healing.SPD = ItemsInventory_lvl2.healing_list [id].SPD;
		healing.heal = ItemsInventory_lvl2.healing_list [id].heal;
		healing.ItemTexture = ItemsInventory_lvl2.healing_list [id].ItemTexture;
		healing.width = ItemsInventory_lvl2.healing_list [id].width;
		healing.height = ItemsInventory_lvl2.healing_list [id].height;
		
		return healing;
	}
Ejemplo n.º 32
0
	public static Healing setHealing(int id, string name, string type, int VIT, int PM, int FRZ,
	                                 int DEF, int SPD, int heal, int magic, string icon_name, 
	                                 int slot_x, int slot_y){
		
		Healing healing = new Healing ();
		healing.id = id;
		healing.name = name;
		healing.type = type;
		healing.VIT = VIT;
		healing.PM = PM;
		healing.FRZ = FRZ;
		healing.DEF = DEF;
		healing.SPD = SPD;
		healing.heal = heal;
		healing.magic = magic;
		healing.ItemTexture = Resources.Load<Texture2D>("Inventory/"+type+"/"+icon_name);
		healing.width = slot_x;
		healing.height = slot_y;

		return healing;
	}
Ejemplo n.º 33
0
	void TypeHealing(){
		
		Healing healing = new Healing ();
		healing.id = id;
		healing.name = name;
		healing.type = type;
		healing.VIT = VIT;
		healing.PM = PM;
		healing.FRZ = FRZ;
		healing.DEF = DEF;
		healing.SPD = SPD;
		healing.heal = heal;
		healing.ItemTexture = imageTexture;
		healing.width = slot_x;
		healing.height = slot_y;
		
		ItemsInventory.addHealing (id, healing);
		inventory.setPotion (1);
		inventory.addItem (ItemsInventory.getHealing (id));
		Destroy (gameObject);
		
	}