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); }
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); }
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); }
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); }
//---------------------------------------------------------------------------- // 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; }
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); }
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); }
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); }
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) }; }
/// <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(); }
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); }
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); }
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); }
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); }
public string GetAttackStatString(AttackStat stat, AttackType attackType) { return(attackDB.GetAttackStat(stat, attackType)[0]); }
public float GetStat(AttackStat stat, int index) { float value = attackValues.GetAttackStat(stat, attackType, index); return(value); }
public float[] GetStatArray(AttackStat stat) { float[] atkFloats = attackValues.GetAttackStatArray(stat, attackType); return(atkFloats); }
public bool GetStatBool(AttackStat stat, int index) { string value = attackValues.GetAttackStatBool(stat, attackType, index); return(bool.Parse(value)); }
private string[] GetBaseAttackStat(AttackStat stat, AttackType attackType) { return(attackDB.GetAttackStat(stat, attackType)); }
public SerializablePlayerStats(AttackStat attackStat, HealthStat healthStat, ExperienceStat experienceStat) { this.attackStat = attackStat; this.healthStat = healthStat; this.experienceStat = experienceStat; }
private void Awake() { attackStat = GetComponent <AttackStat>(); }
public string[] GetAttackStat(AttackStat stat, AttackType attackType) { BuildLookup(); return(lookupTable[attackType][stat]); }
public override string InfoDamage() { return("dfs up " + AttackStat.ToString()); }