Ejemplo n.º 1
0
        public void Init()
        {
            var testBehavior     = new TalentsBehavior(null);
            var warriorAttribute = new WarriorAttribute();
            var rogueAttribute   = new RogueAttribute();
            var mageAttribute    = new MageAttribute();
            var damageStat       = new DamageStat();
            var attackStat       = new AttackStat();

            this.playerThing = new Thing()
            {
                Name = "PlayerThing", Id = TestThingID.Generate("testthing")
            };

            playerThing.Behaviors.Add(testBehavior);

            warriorAttribute.Parent = this.playerThing;
            playerThing.AddAttribute(warriorAttribute);

            mageAttribute.Parent = this.playerThing;
            playerThing.AddAttribute(rogueAttribute);

            rogueAttribute.Parent = this.playerThing;
            playerThing.AddAttribute(mageAttribute);

            warriorAttribute.SetValue(10, playerThing);
            rogueAttribute.SetValue(10, playerThing);
            mageAttribute.SetValue(10, playerThing);

            playerThing.Stats.Add(damageStat.Name, damageStat);
            playerThing.Stats.Add(attackStat.Name, attackStat);
        }
Ejemplo n.º 2
0
        public float GetAttackStat(AttackStat stat, AttackType attackType, int i)
        {
            string[] s     = GetBaseAttackStat(stat, attackType);
            float    total = 0;

            // For stat modifiers, 0 is Additive, 1 is Percentage. From .asset values
            float[] atkStatModifiers = GetAtkStatModifiers(stat, attackType);
            total = (float.Parse(s[i]) + atkStatModifiers[1]) * (1 + atkStatModifiers[0] / 100);

            return(total);
        }
Ejemplo n.º 3
0
        public float[] GetAttackStatArray(AttackStat stat, AttackType attackType)
        {
            string[] s     = GetBaseAttackStat(stat, attackType);
            float[]  total = new float[s.Length];
            for (int i = 0; i < s.Length; i++)
            {
                float[] atkStatModifiers = GetAtkStatModifiers(stat, attackType);
                total[i] = (float.Parse(s[i]) + atkStatModifiers[1]) * (1 + atkStatModifiers[0] / 100);
            }

            return(total);
        }
Ejemplo n.º 4
0
 private float[] GetAtkStatModifiers(AttackStat stat, AttackType attackType)
 {
     float[] total = new float[] { 0, 0 };
     foreach (IAttackEffectProvider fxProvider in GetComponents <IAttackEffectProvider>())
     {
         foreach (float[] modifier in fxProvider.GetAtkStatModifiers(attackType, stat))
         {
             total[0] += modifier[0];
             total[1] += modifier[1];
         }
     }
     return(total);
 }
Ejemplo n.º 5
0
        //----------------------------------------------------------------------------
        //                    Constructor
        //----------------------------------------------------------------------------

        #region Constructor

        public AttackData(IHasAttack hasAttack, AttackRangeType rangeType,
                          AttackType attackType, AttackStat attackStat)
        {
            MyHasAttack = hasAttack;
            MyIsVictim  = null;

            MyRangeType  = rangeType;
            MyAttackType = attackType;
            MyAttackStat = attackStat;

            Advantage      = false;
            Disadvantage   = false;
            SumOfModifiers = 0;
        }
Ejemplo n.º 6
0
        public string GetAttackStatBool(AttackStat stat, AttackType attackType, int index)
        {
            string sAtkBool    = attackDB.GetAttackStat(stat, attackType)[index];
            string resultBools = null;

            foreach (IAttackEffectProvider fxAtk in GetComponents <IAttackEffectProvider>())
            {
                foreach (bool fxValue in fxAtk.GetAtkBooleanModifiers(attackType, stat))
                {
                    resultBools = (bool.Parse(sAtkBool) || fxValue).ToString();
                }
            }
            return(resultBools);
        }
Ejemplo n.º 7
0
        public IEnumerable <bool> GetAtkBooleanModifiers(AttackType atkType, AttackStat attackStat)
        {
            if (buffList.Count == 0)
            {
                yield return(false);
            }

            bool result = false;

            //Run through each active buff
            foreach (string id in buffList.Keys)
            {
                EffectName effect = (EffectName)Enum.Parse(typeof(EffectName), id);
                // Check if effect type boosts Attack, otherwise desired EffectStats aren't assigned
                if (effectDB.GetEffectStat(EffectStat.EffectType, effect) == "Atk Boost")
                {
                    // Skip if not a boolean buff value
                    if (int.Parse(effectDB.GetEffectStat(EffectStat.Additive, effect)) != 2)
                    {
                        continue;
                    }

                    // Get affected skill list and compare with the provided AtkType
                    string fxAttackTypes = effectDB.GetEffectStat(EffectStat.AtkTypesAffected, effect);
                    if (fxAttackTypes == "All" || fxAttackTypes.Contains(atkType.ToString()))
                    {
                        string fxAttackStats = effectDB.GetEffectStat(EffectStat.AtkStatsAffected, effect);
                        // Compare the Effect stat to the provided stat
                        if (fxAttackStats.Contains(attackStat.ToString()))
                        {
                            // Check and assign value, then check if buff is consumed on activation
                            if (effectDB.GetEffectStat(EffectStat.AtkEffectValues, effect).ToLower() == "true")
                            {
                                result = true;
                            }
                            if (int.Parse(effectDB.GetEffectStat(EffectStat.Consumed, effect)) == 1)
                            {
                                removeIDs.Add(id);
                            }
                        }
                    }
                }
            }

            yield return(result);
        }
Ejemplo n.º 8
0
        public IEnumerable <float[]> GetAtkStatModifiers(AttackType atkType, AttackStat attackStat)
        {
            if (buffList.Count == 0)
            {
                yield return new float[] { 0, 0 }
            }
            ;

            float[] result = new float[] { 0, 0 };
            //Run through each active buff
            foreach (string id in buffList.Keys)
            {
                EffectName effect = (EffectName)Enum.Parse(typeof(EffectName), id);

                // Check if effect type boosts Attack, otherwise desired EffectStats aren't assigned
                if (effectDB.GetEffectStat(EffectStat.EffectType, effect) == "Atk Boost")
                {
                    // Skip if buff value is a bool
                    int modType = int.Parse(effectDB.GetEffectStat(EffectStat.Additive, effect));
                    if (modType == 2)
                    {
                        continue;
                    }

                    // Get affected skill list and compare with the provided AtkType
                    string fxAttackTypes = effectDB.GetEffectStat(EffectStat.AtkTypesAffected, effect);
                    if (fxAttackTypes == "All" || fxAttackTypes.Contains(atkType.ToString()))
                    {
                        string fxAttackStats = effectDB.GetEffectStat(EffectStat.AtkStatsAffected, effect);
                        // Compare the Effect stat to the provided stat
                        if (fxAttackStats.Contains(attackStat.ToString()))
                        {
                            // Check and assign value, then check if buff is consumed on activation
                            result[modType] += float.Parse(effectDB.GetEffectStat(EffectStat.AtkEffectValues, effect));
                            if (int.Parse(effectDB.GetEffectStat(EffectStat.Consumed, effect)) == 1 && !removeIDs.Contains(id))
                            {
                                removeIDs.Add(id);
                            }
                        }
                    }
                }
            }

            yield return(result);
        }
Ejemplo n.º 9
0
        public Chris(Player owner, Player opponent, ICollection <Card> container, GameController game, GameActions actions)
            : base(owner, opponent, container, game, actions)
        {
            Attack   = new AttackStat(AttackMode.Frontal, 3);
            Movement = new MovementStat(MovementMode.March, 10);

            Abilites = new List <Ability>
            {
                new Move(this, Movement),
                new Attack(this, Attack),
                new ChrisDrinksAbility(this)
            };

            TriggerEffects = new List <TriggerEffect>
            {
                new DrinkEffect(this)
            };
        }
Ejemplo n.º 10
0
    /// <summary>
    /// Set the lists of player stats when the game starts.
    /// </summary>
    void SetPlayerStat()
    {
        SerializablePlayerStats playerState = SaveLoadManager.Instance.FileManager.SerializablePlayerStats;

        attackStat = playerState.AttackStat;
        healthStat = playerState.HealthStat;

        if (playerState.ExperienceStat.ListItemsCount == 0)
        {
            experienceStat.AddStat(new BaseStat(ExperienceStatNames.Level1, StatType.ExperienceStat, ExperienceStatValues.Level1));
        }
        else
        {
            experienceStat = playerState.ExperienceStat;
        }

        ShowPlayerStats();
    }
Ejemplo n.º 11
0
    public override bool GetDamage(AttackStat attackStat, HitType hitType = HitType.Normal, CUnit unit = null, ActionAnim actionAnim = null)
    {
        bool isDead = false;

        if (m_status.CurState == State.Dead)
        {
            return(false);
        }

        float fMotionMul = actionAnim != null ? actionAnim.fMotionMagnifi : 1f;

        if (m_status.GetDamage(attackStat, out isDead, fMotionMul))
        {
            if (m_unitUI != null)
            {
                m_unitUI.SetHPGuageFill(m_status.GetHpAmount());
            }
            MainHookClose();
            m_actCtrl.ResetAttack();
            m_actCtrl.GetHitAction(hitType);

            if (unit == null)
            {
                return(true);
            }

            if (m_actCtrl.Target != null)
            {
                if (unit.tag == "Player")
                {
                    m_actCtrl.Target = unit;
                }
            }

            return(true);
        }

        if (isDead)
        {
            DeathProcess();
        }

        return(false);
    }
Ejemplo n.º 12
0
        public Thomas(Player owner, Player opponent, ICollection <Card> container, GameController game, GameActions actions)
            : base(owner, opponent, container, game, actions)
        {
            Attack   = new AttackStat(AttackMode.Frontal, 3);
            Movement = new MovementStat(MovementMode.March, 10);

            Abilites = new List <Ability>
            {
                new Move(this, Movement),
                new Attack(this, Attack),
                new SayChooChooAbility(this)
            };

            TriggerEffects = new List <TriggerEffect>
            {
                new PunchFascistsEffect(this),
            };

            Debug.Log(Abilites);
        }
Ejemplo n.º 13
0
        public void AddTalentWithRulesBeforeBehaviorParentSetTest()
        {
            var testBehavior     = new TalentsBehavior(null);
            var warriorAttribute = new WarriorAttribute();
            var rogueAttribute   = new RogueAttribute();
            var mageAttribute    = new MageAttribute();
            var damageStat       = new DamageStat();
            var attackStat       = new AttackStat();

            warriorAttribute.Parent = this.playerThing;
            playerThing.AddAttribute(warriorAttribute);

            mageAttribute.Parent = this.playerThing;
            playerThing.AddAttribute(rogueAttribute);

            rogueAttribute.Parent = this.playerThing;
            playerThing.AddAttribute(mageAttribute);

            warriorAttribute.SetValue(10, playerThing);
            rogueAttribute.SetValue(10, playerThing);
            mageAttribute.SetValue(10, playerThing);

            playerThing.Stats.Add(damageStat.Name, damageStat);
            playerThing.Stats.Add(attackStat.Name, attackStat);

            var testTalent = new ChampionTalent();

            playerThing.Behaviors.Add(testBehavior);

            var behavior = playerThing.Behaviors.FindFirst <TalentsBehavior>();

            behavior.AddTalent(testTalent);

            Verify.IsTrue(behavior.ManagedTalents.Contains(testTalent));
            Verify.IsNotNull(testTalent.PlayerThing);

            behavior.RemoveTalent(testTalent);

            playerThing.Behaviors.Remove(testBehavior);
        }
Ejemplo n.º 14
0
        public void Init()
        {
            this.playerThing = new Thing()
            {
                Name = "PlayerThing", ID = TestThingID.Generate("testthing")
            };

            var testBehavior     = new TalentsBehavior(null);
            var warriorAttribute = new WarriorAttribute();
            var rogueAttribute   = new RogueAttribute();
            var mageAttribute    = new MageAttribute();
            var damageStat       = new DamageStat();
            var attackStat       = new AttackStat();
            var initiativeStat   = new InitiativeStat();
            var awarenessSkill   = new SkillAwareness();

            warriorAttribute.Parent = this.playerThing;
            this.playerThing.AddAttribute(warriorAttribute);

            mageAttribute.Parent = this.playerThing;
            this.playerThing.AddAttribute(rogueAttribute);

            rogueAttribute.Parent = this.playerThing;
            this.playerThing.AddAttribute(mageAttribute);

            warriorAttribute.SetValue(10, this.playerThing);
            rogueAttribute.SetValue(10, this.playerThing);
            mageAttribute.SetValue(10, this.playerThing);

            this.playerThing.Stats.Add(damageStat.Name, damageStat);
            this.playerThing.Stats.Add(attackStat.Name, attackStat);
            this.playerThing.Stats.Add(initiativeStat.Name, initiativeStat);

            this.playerThing.Skills.Add(awarenessSkill.Name, awarenessSkill);

            this.playerThing.Behaviors.Add(testBehavior);
        }
Ejemplo n.º 15
0
 public string GetAttackStatString(AttackStat stat, AttackType attackType)
 {
     return(attackDB.GetAttackStat(stat, attackType)[0]);
 }
Ejemplo n.º 16
0
        public float GetStat(AttackStat stat, int index)
        {
            float value = attackValues.GetAttackStat(stat, attackType, index);

            return(value);
        }
Ejemplo n.º 17
0
 public float[] GetStatArray(AttackStat stat)
 {
     float[] atkFloats = attackValues.GetAttackStatArray(stat, attackType);
     return(atkFloats);
 }
Ejemplo n.º 18
0
        public bool GetStatBool(AttackStat stat, int index)
        {
            string value = attackValues.GetAttackStatBool(stat, attackType, index);

            return(bool.Parse(value));
        }
Ejemplo n.º 19
0
 private string[] GetBaseAttackStat(AttackStat stat, AttackType attackType)
 {
     return(attackDB.GetAttackStat(stat, attackType));
 }
Ejemplo n.º 20
0
 public SerializablePlayerStats(AttackStat attackStat, HealthStat healthStat, ExperienceStat experienceStat)
 {
     this.attackStat     = attackStat;
     this.healthStat     = healthStat;
     this.experienceStat = experienceStat;
 }
Ejemplo n.º 21
0
 private void Awake()
 {
     attackStat = GetComponent <AttackStat>();
 }
Ejemplo n.º 22
0
        public string[] GetAttackStat(AttackStat stat, AttackType attackType)
        {
            BuildLookup();

            return(lookupTable[attackType][stat]);
        }
Ejemplo n.º 23
0
 public override string InfoDamage()
 {
     return("dfs up " + AttackStat.ToString());
 }