Пример #1
0
    //施放完技能直接觸發,只用在降低Stat方面,扣HP等回合開始時觸發。
    public void TriggerImmediately(Unit unit, int index)
    {
        FG_SpellStatus sta = unit.savedCharacter.PlayerVitals.ActiveStati[index];

        if (sta.StatModifierCode.Contains("Attack"))
        {
            unit.savedCharacter.PlayerVitals.Attack += (int)(unit.savedCharacter.PlayerVitals.MaxAttack * sta.ModifyAmount);
        }
        else if (sta.StatModifierCode.Contains("SpAttack"))
        {
            unit.savedCharacter.PlayerVitals.SpAttack += (int)(unit.savedCharacter.PlayerVitals.MaxSpAttack * sta.ModifyAmount);
        }
        else if (sta.StatModifierCode.Contains("Defense"))
        {
            unit.savedCharacter.PlayerVitals.Defense += (int)(unit.savedCharacter.PlayerVitals.MaxDefense * sta.ModifyAmount);
        }
        else if (sta.StatModifierCode.Contains("SpDefense"))
        {
            unit.savedCharacter.PlayerVitals.SpDefense += (int)(unit.savedCharacter.PlayerVitals.MaxSpDefense * sta.ModifyAmount);
        }
        else if (sta.StatModifierCode.Contains("Speed"))
        {
            unit.savedCharacter.PlayerVitals.Speed += (int)(unit.savedCharacter.PlayerVitals.MaxSpeed * sta.ModifyAmount);
        }
    }
Пример #2
0
    void IsSpellApplyStatus(Unit unit, FG_Spell spell)
    {
        if (spell.ApplyStatus == null)
        {
            return;
        }

        foreach (var go in unitControlller.UintInSpellRange())
        {
            float          rng          = Random.Range(0f, 1f);
            bool           success      = (spell.ApplyStatus.ChanceToApply >= rng) ? true : false;
            FG_SpellStatus activeStatus = go.savedCharacter.PlayerVitals.ActiveStati.Find(x => x.StatusName.Contains(spell.ApplyStatus.StatusName));
            if (success && activeStatus == null)
            {
                FG_SpellStatus status = new FG_SpellStatus()
                {
                    ChanceToApply     = spell.ApplyStatus.ChanceToApply,
                    FX                = spell.ApplyStatus.FX,
                    Icon              = spell.ApplyStatus.Icon,
                    ModifyAmount      = spell.ApplyStatus.ModifyAmount,
                    StatModifierCode  = spell.ApplyStatus.StatModifierCode,
                    StatusDescription = spell.ApplyStatus.StatusDescription,
                    StatusName        = spell.ApplyStatus.StatusName,
                    Target            = spell.ApplyStatus.Target,
                    Turns             = spell.ApplyStatus.Turns
                };

                go.savedCharacter.PlayerVitals.ActiveStati.Add(status);
                unitControlller.spellController.TriggerImmediately(go, go.savedCharacter.PlayerVitals.ActiveStati.Count - 1);

                if (status.Target.Contains("Player"))
                {
                    go.EnableBuff(true);
                }
                else if (status.Target.Contains("Enemy"))
                {
                    go.EnableBuff(false);
                }

                Debug.Log("rng : " + rng + " | ChanceToApply : " + spell.ApplyStatus.ChanceToApply);
            }
            else if (success && activeStatus != null)
            {
                Debug.Log("unit is under effecting");
            }
            else
            {
                Debug.Log("Spell status did not trigged !");
            }
        }
    }
Пример #3
0
 // copy ctor
 public FG_SpellStatus(FG_SpellStatus prius)
 {
     if (prius != null)
     {
         this.StatusName = prius.StatusName;
         this.Target     = prius.Target;
         //this.UpgradeReq = prius.UpgradeReq;
         this.StatusDescription = prius.StatusDescription;
         this.StatModifierCode  = prius.StatModifierCode;
         this.ModifyAmount      = prius.ModifyAmount;
         this.ChanceToApply     = prius.ChanceToApply;
         this.Turns             = prius.Turns;
         this.Icon = prius.Icon;
         this.FX   = prius.FX;
     }
 }
Пример #4
0
 //copy ctor
 public FG_SpellDetail(FG_SpellDetail prius)
 {
     if (prius != null)
     {
         this.Description = prius.Description;
         this.Icon        = prius.Icon;
         this.Target      = prius.Target;
         this.BaseDmg     = prius.BaseDmg;
         this.ManaCost    = prius.ManaCost;
         this.BaseDmg     = prius.BaseDmg;
         //this.UpgradePower = prius.UpgradePower;
         //this.UpgradeLevels = prius.UpgradeLevels;
         this.FX          = prius.FX;
         this.Cooldown    = prius.Cooldown;
         this.LevelReq    = prius.LevelReq;
         this.ApplyStatus = new FG_SpellStatus(prius.ApplyStatus);
     }
 }
Пример #5
0
    public void TriggerStatus(Unit unit)
    {
        //onTurnStart|under attacking|onTurnEnd
        for (int i = 0; i < unit.savedCharacter.PlayerVitals.ActiveStati.Count; i++)
        {
            FG_SpellStatus sta = unit.savedCharacter.PlayerVitals.ActiveStati[i];

            sta.Turns--;
            Debug.Log(unit.name + " is under status effect and left turn is : " + sta.Turns);
            if (sta.Turns < 0)
            {
                if (sta.StatModifierCode.Contains("Attack"))
                {
                    unit.savedCharacter.PlayerVitals.Attack += (int)(unit.savedCharacter.PlayerVitals.MaxAttack * sta.ModifyAmount) * -1;
                }
                else if (sta.StatModifierCode.Contains("SpAttack"))
                {
                    unit.savedCharacter.PlayerVitals.SpAttack += (int)(unit.savedCharacter.PlayerVitals.MaxSpAttack * sta.ModifyAmount) * -1;
                }
                else if (sta.StatModifierCode.Contains("Defense"))
                {
                    unit.savedCharacter.PlayerVitals.Defense += (int)(unit.savedCharacter.PlayerVitals.MaxDefense * sta.ModifyAmount) * -1;
                }
                else if (sta.StatModifierCode.Contains("SpDefense"))
                {
                    unit.savedCharacter.PlayerVitals.SpDefense += (int)(unit.savedCharacter.PlayerVitals.MaxSpDefense * sta.ModifyAmount) * -1;
                }
                else if (sta.StatModifierCode.Contains("Speed"))
                {
                    unit.savedCharacter.PlayerVitals.Speed += (int)(unit.savedCharacter.PlayerVitals.MaxSpeed * sta.ModifyAmount) * -1;
                }

                Debug.Log(unit.name + " is break the status : " + sta.StatusName);
                unit.savedCharacter.PlayerVitals.ActiveStati.Remove(sta);

                if (sta.Target.Contains("Player"))
                {
                    unit.DisableBuff(true);
                }
                else if (sta.Target.Contains("Enemy"))
                {
                    unit.DisableBuff(false);
                }
            }
            else
            {
                if (sta.StatModifierCode.Contains("HP"))
                {
                    if (sta.ModifyAmount > 0)
                    {
                        unit.savedCharacter.PlayerVitals.Health += 20;
                        if (unit.savedCharacter.PlayerVitals.Health > unit.savedCharacter.PlayerVitals.MaxHealth)
                        {
                            unit.savedCharacter.PlayerVitals.Health = unit.savedCharacter.PlayerVitals.MaxHealth;
                        }
                    }
                    else
                    {
                        unit.TakeDamage(1);
                        ShowFX(unit.gameObject);
                    }
                }
            }
        }
    }