private void ModifyUnitStats(UnitStat tgtStats, UnitStat srcStats) { tgtStats.HP += srcStats.HP; tgtStats.AP += srcStats.AP; tgtStats.HPPerTurn += srcStats.HPPerTurn; tgtStats.APPerTurn += srcStats.APPerTurn; tgtStats.moveAPCost += srcStats.moveAPCost; tgtStats.attackAPCost += srcStats.attackAPCost; tgtStats.turnPriority += srcStats.turnPriority; tgtStats.moveRange += srcStats.moveRange; tgtStats.attackRange += srcStats.attackRange; tgtStats.hitChance += srcStats.hitChance; tgtStats.dodgeChance += srcStats.dodgeChance; tgtStats.damage += srcStats.damage; //tgtStats.damageMin+=srcStats.damageMin; //tgtStats.damageMax+=srcStats.damageMax; tgtStats.movePerTurn += srcStats.movePerTurn; tgtStats.attackPerTurn += srcStats.attackPerTurn; tgtStats.counterPerTurn += srcStats.counterPerTurn; tgtStats.critChance += srcStats.critChance; tgtStats.critAvoidance += srcStats.critAvoidance; tgtStats.critMultiplier += srcStats.critMultiplier; tgtStats.stunChance += srcStats.stunChance; tgtStats.stunAvoidance += srcStats.stunAvoidance; tgtStats.stunDuration += srcStats.stunDuration; tgtStats.silentChance += srcStats.silentChance; tgtStats.silentAvoidance += srcStats.silentAvoidance; tgtStats.silentDuration += srcStats.silentDuration; tgtStats.sight += srcStats.sight; }
public UnitStat Clone() { UnitStat stat = new UnitStat(); stat.HP = HP; stat.AP = AP; stat.HPPerTurn = HPPerTurn; stat.APPerTurn = APPerTurn; stat.moveAPCost = moveAPCost; stat.attackAPCost = attackAPCost; stat.turnPriority = turnPriority; stat.moveRange = moveRange; stat.attackRange = attackRange; stat.sight = sight; stat.movePerTurn = movePerTurn; stat.attackPerTurn = attackPerTurn; stat.counterPerTurn = counterPerTurn; stat.damage = damage; stat.damageMin = damageMin; stat.damageMax = damageMax; stat.hitChance = hitChance; stat.dodgeChance = dodgeChance; stat.critChance = critChance; stat.critAvoidance = critAvoidance; stat.critMultiplier = critMultiplier; stat.stunChance = stunChance; stat.stunAvoidance = stunAvoidance; stat.stunDuration = stunDuration; stat.silentChance = silentChance; stat.silentAvoidance = silentAvoidance; stat.silentDuration = silentDuration; stat.flankingBonus = flankingBonus; stat.flankedModifier = flankedModifier; return(stat); }
protected float DrawStatsModifier(float startX, float startY, UnitStat effect) { string text = "Stats Modifier " + (!foldStats ? "(show)" : "(hide)"); foldStats = EditorGUI.Foldout(new Rect(startX, startY, width, height), foldStats, text, foldoutStyle); if (foldStats) { startX += 15; spaceX += 10; cont = new GUIContent("HP/AP Buff:", "HitPoint(HP)/ActionPoint(AP) multiplier to be applied to the target. ie, 0.2 being increment by 20%, -0.1 being reduction by 10%"); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); effect.HP = EditorGUI.FloatField(new Rect(startX + spaceX, startY, widthS, height), effect.HP); effect.AP = EditorGUI.FloatField(new Rect(startX + spaceX + widthS + 2, startY, widthS, height), effect.AP); cont = new GUIContent("HP/AP PerTurn:", "HitPoint(HP)/ActionPoint(AP) gain per turn modifier to be applied to the target."); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); effect.HPPerTurn = EditorGUI.FloatField(new Rect(startX + spaceX, startY, widthS, height), effect.HPPerTurn); effect.APPerTurn = EditorGUI.FloatField(new Rect(startX + spaceX + widthS + 2, startY, widthS, height), effect.APPerTurn); startY += 5; cont = new GUIContent("MoveAPCost:", "Move AP cost modifier to be applied to the target."); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); effect.moveAPCost = EditorGUI.FloatField(new Rect(startX + spaceX, startY, widthS, height), effect.moveAPCost); cont = new GUIContent("AttackAPCost:", "Attack AP cost modifier to be applied to the target."); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); effect.attackAPCost = EditorGUI.FloatField(new Rect(startX + spaceX, startY, widthS, height), effect.attackAPCost); startY += 5; cont = new GUIContent("Turn Priority:", "Turn Priority modifier to be applied to the target"); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); effect.turnPriority = EditorGUI.FloatField(new Rect(startX + spaceX, startY, widthS, height), effect.turnPriority); startY += 5; cont = new GUIContent("MoveRange:", "Movement range modifier (in tile) to be applied to the target"); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); effect.moveRange = EditorGUI.IntField(new Rect(startX + spaceX, startY, widthS, height), effect.moveRange); cont = new GUIContent("AttackRange:", "Attack range modifier (in tile) to be applied to the target"); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); effect.attackRange = EditorGUI.IntField(new Rect(startX + spaceX, startY, widthS, height), effect.attackRange); cont = new GUIContent("Sight:", "modifier to be applied to the target. "); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); effect.sight = EditorGUI.IntField(new Rect(startX + spaceX, startY, widthS, height), effect.sight); startY += 5; cont = new GUIContent("MovePerTurn:", "Move-per-turn modifier to be applied to the target. Doesnt apply to tile"); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); effect.movePerTurn = EditorGUI.IntField(new Rect(startX + spaceX, startY, widthS, height), effect.movePerTurn); cont = new GUIContent("AttackPerTurn:", "Attack-per-turn modifier to be applied to the target. Doesnt apply to tile"); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); effect.attackPerTurn = EditorGUI.IntField(new Rect(startX + spaceX, startY, widthS, height), effect.attackPerTurn); cont = new GUIContent("CounterPerTurn:", "CounterAttack-per-turn modifier to be applied to the target. Doesnt apply to tile"); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); effect.counterPerTurn = EditorGUI.IntField(new Rect(startX + spaceX, startY, widthS, height), effect.counterPerTurn); startY += 5; cont = new GUIContent("Damage:", "Damage multiplier to be applied to the target's both min and max damage. ie, 0.2 being increment by 20%, -0.1 being reduction by 10%"); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); effect.damage = EditorGUI.FloatField(new Rect(startX + spaceX, startY, widthS, height), effect.damage); cont = new GUIContent("Hit/Dodge Chance:", "Hit Chance multiplier to be applied to the target. ie, 0.2 being increment by 20%, -0.1 being reduction by 10%"); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); effect.hitChance = EditorGUI.FloatField(new Rect(startX + spaceX, startY, widthS, height), effect.hitChance); effect.dodgeChance = EditorGUI.FloatField(new Rect(startX + spaceX + widthS + 2, startY, widthS, height), effect.dodgeChance); startY += 5; cont = new GUIContent("Crit/Avoid Chance:", "Multiplier to be applied to the target. ie, 0.2 being increment by 20%, -0.1 being reduction by 10%"); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); effect.critChance = EditorGUI.FloatField(new Rect(startX + spaceX, startY, widthS, height), effect.critChance); effect.critAvoidance = EditorGUI.FloatField(new Rect(startX + spaceX + widthS + 2, startY, widthS, height), effect.critAvoidance); cont = new GUIContent("CritMultiplier:", "Critical damage multiplier to be applied to the target. ie, 0.2 being increment by 20%, -0.1 being reduction by 10%"); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); effect.critMultiplier = EditorGUI.FloatField(new Rect(startX + spaceX, startY, widthS, height), effect.critMultiplier); startY += 5; cont = new GUIContent("Stun/Avoid Chance:", "Multiplier to be applied to the target. ie, 0.2 being increment by 20%, -0.1 being reduction by 10%"); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); effect.stunChance = EditorGUI.FloatField(new Rect(startX + spaceX, startY, widthS, height), effect.stunChance); effect.stunAvoidance = EditorGUI.FloatField(new Rect(startX + spaceX + widthS + 2, startY, widthS, height), effect.stunAvoidance); cont = new GUIContent("StunDuration:", "Stun duration modifier to be applied to the target. "); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); effect.stunDuration = EditorGUI.IntField(new Rect(startX + spaceX, startY, widthS, height), effect.stunDuration); startY += 5; cont = new GUIContent("Silent/Avoid Chance:", "Multiplier to be applied to the target. ie, 0.2 being increment by 20%, -0.1 being reduction by 10%"); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); effect.silentChance = EditorGUI.FloatField(new Rect(startX + spaceX, startY, widthS, height), effect.silentChance); effect.silentAvoidance = EditorGUI.FloatField(new Rect(startX + spaceX + widthS + 2, startY, widthS, height), effect.silentAvoidance); cont = new GUIContent("SilentDuration:", "Silent duration modifier to be applied to the target. "); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); effect.silentDuration = EditorGUI.IntField(new Rect(startX + spaceX, startY, widthS, height), effect.silentDuration); startY += 5; cont = new GUIContent("Flanking Bonus:", "Damage multiplier to be applied to the unit when flanking a target. Takes value from 0 and above with 0.2 being increase the damage by 20%"); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); effect.flankingBonus = EditorGUI.FloatField(new Rect(startX + spaceX, startY, widthS, height), effect.flankingBonus); cont = new GUIContent("Flanked Modifier:", "Damage multiplier to be applied to the unit when being flanked. Takes value from 0 and above with 0.2 being reduce the incoming damage by 20%"); EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); effect.flankedModifier = EditorGUI.FloatField(new Rect(startX + spaceX, startY, widthS, height), effect.flankedModifier); spaceX -= 10; } return(startY + spaceY); }