void ApplyStatus(BaseStatusEffect status)
    {
        status.statusEffectCaster = GameObject.Find(hero.theName);

        EnemyToAttack.GetComponent <EnemyStateMachine>().enemy.debuffs.Add(status);
        EnemyToAttack.GetComponent <EnemyStateMachine>().enemy.isDebuffed = true;
    }
    void DoDamage()
    {
        if (EnemyToAttack.GetComponent <EnemyStateMachine>().enemy.debuffs.Count == 0)
        {
            EnemyToAttack.GetComponent <EnemyStateMachine>().enemy.isDebuffed = false;
        }
        float calc_damage = hero.curATK + BSM.PerformList[0].chosenAttack.attackDamage;

        EnemyToAttack.GetComponent <EnemyStateMachine>().TakeDamage(calc_damage);

        //check if enemy is alive after initial ability hit before worrying about dots on the enemy
        if (EnemyToAttack.GetComponent <EnemyStateMachine>().enemy.curHP > 0)
        {
            print(BSM.PerformList[0].chosenAttack.debuffRoundDuration);

            if (BSM.PerformList[0].chosenAttack.hasStatusEffect || EnemyToAttack.GetComponent <EnemyStateMachine>().enemy.isDebuffed)
            {
                BaseStatusEffect newStatusEffect = new BaseStatusEffect();
                newStatusEffect.effectName          = BSM.PerformList[0].chosenAttack.debuffName;
                newStatusEffect.effectRoundDuration = BSM.PerformList[0].chosenAttack.debuffRoundDuration;
                newStatusEffect.effectTickAmount    = BSM.PerformList[0].chosenAttack.debuffTickAmount;

                for (int j = 0; j < EnemyToAttack.GetComponent <EnemyStateMachine>().enemy.debuffs.Count; j++)
                {
                    if (string.Equals(EnemyToAttack.GetComponent <EnemyStateMachine>().enemy.debuffs[j].effectName, newStatusEffect.effectName))
                    {
                        //Remove so we can apply with new calc
                        EnemyToAttack.GetComponent <EnemyStateMachine>().enemy.debuffs.Remove(newStatusEffect);
                    }
                }

                ApplyStatus(newStatusEffect);
                DoStatus();
            }
        }
        BL.CreateText("1" + "," +
                      "0" + "," +
                      hero.charTurnNum + "," +
                      "Player" + "," +
                      hero.theName + "," +
                      EnemyToAttack.GetComponent <EnemyStateMachine>().enemy.theName + "," +
                      BSM.PerformList[0].chosenAttack.attackName + "," +
                      BSM.PerformList[0].chosenAttack.hitNumber + "," +
                      BSM.PerformList[0].chosenAttack.attackDamage + "," +
                      EnemyToAttack.GetComponent <EnemyStateMachine>().enemy.curHP + "," +
                      EnemyToAttack.GetComponent <EnemyStateMachine>().enemy.baseHP + "," +
                      hero.isHasted + "," +
                      hero.hasteMod + "," +
                      hero.isDamageBuffed + "," +
                      hero.damageBuffMod + "," +
                      hero.isDamageTakenIncreased + "," +
                      hero.damageTakenMod + "\n");
        hero.charTurnNum++;
    }
Exemplo n.º 3
0
        public static void ApplyStatusEfect(this PlayerData player, BaseStatusEffect effect)
        {
            var eot = new TickEvent(effect.OnTick);

            if (player.Durations.Contains(eot))
            {
                player.Durations[eot] = (int)player.Durations[eot] + effect.Duration;
            }
            else
            {
                player.OnTick += new TickEvent(effect.OnTick);
                player.Durations.Add(new TickEvent(effect.OnTick), effect.Duration);
            }
        }
Exemplo n.º 4
0
 // Function to add or reapply a Status Effect
 // Key should be the name of the prefab
 public bool AddEffect(string key, BaseStatusEffect newEffect, EnemyBaseClass newOwner)
 {
     // If status effect is already in, then reset and return
     if (activeStatus.ContainsKey(key))
     {
         activeStatus[key].onReApply();
         newEffect.gameObject.SetActive(false);
         return(false);
     }
     // Not in dictionary, so add
     activeStatus.Add(key, newEffect);
     // call onApply as we just added it
     newEffect.onApply(newOwner);
     return(true);
 }
Exemplo n.º 5
0
 public EffectPack(int chanceToSucceed, BaseStatusEffect statusEffect)
 {
     ChanceToSucceed = chanceToSucceed;
     StatusEffect    = statusEffect;
 }