Example #1
0
 public ExecuteEffectEvent(SkillPartBase effect, BattlePawnBase caster, BattlePawnBase target, bool fromSpell = false, int valueFromPrevious = -1)
 {
     this.effect            = effect;
     this.caster            = caster;
     this.target            = target;
     this.fromSpell         = fromSpell;
     this.valueFromPrevious = valueFromPrevious;
 }
Example #2
0
 /// <summary>
 /// Updates the given stat display with the stats of the selected pawn
 /// <see cref="BattlePawnBase"/>
 /// </summary>
 private void UpdateStats(BattlePawnBase pawn, Text[] statDisplays)
 {
     statDisplays[0].text = pawn.name;
     statDisplays[1].text = "Atk: " + pawn.GetEffectiveStat(Stats.Attack);
     statDisplays[2].text = "Def: " + pawn.GetEffectiveStat(Stats.Defense);
     statDisplays[3].text = "mAtk: " + pawn.GetEffectiveStat(Stats.MagicAttack);
     statDisplays[4].text = "mDef: " + pawn.GetEffectiveStat(Stats.MagicDefense);
     statDisplays[5].text = "Speed: " + pawn.GetEffectiveStat(Stats.MaxMove);
     statDisplays[6].text = "Crit: " + pawn.GetEffectiveStat(Stats.CritChance) + "%";
     statDisplays[7].text = "Health: " + pawn.cHealth + "/" + pawn.GetEffectiveStat(Stats.MaxHealth);
 }
Example #3
0
    public BattleOnlyStats(int x, int y, BattlePawnBase pawn)
    {
        modifierList = new List <StatMod>();
        position     = new Vector2Int(x, y);
        moved        = false;
        facing       = FacingDirection.North;

        temporaryEffectList = new List <Pair <TriggeredEffect, TemporaryEffectData> >();
        foreach (Equippable i in pawn.equipment)
        {
            if (i != null)
            {
                foreach (AddTriggerPart effect in ((EquippableBase)Registry.ItemRegistry[i.Name]).effects)
                {
                    temporaryEffectList.Add(new Pair <TriggeredEffect, TemporaryEffectData>(effect.effect,
                                                                                            new TemporaryEffectData(effect.maxTimesThisBattle, effect.turnCooldown, effect.maxActiveTurns)));
                }
            }
        }
    }
Example #4
0
 public TurnEvent(BattlePawnBase turner, FacingDirection direction)
 {
     this.turner    = turner;
     this.direction = direction;
 }
Example #5
0
    /// <summary>
    /// Updates the visuals shown based on what units are selected on the field
    /// </summary>
    public void UpdateSelectedUnit()
    {
        //If a player is selected
        if (battleController.selectedPlayer != -1)
        {
            playerStats.SetActive(true);
            UpdateStats(battleController.players[battleController.selectedPlayer], playerStats.GetComponentsInChildren <Text>());
            if (Battle.battleState != BattleState.Swap && !battleController.players[battleController.selectedPlayer].tempStats.moved)
            {
                quickSkill1.SetActive(true);
                quickSkill2.SetActive(true);
                quickSkill3.SetActive(true);
            }
            else
            {
                quickSkill1.SetActive(false);
                quickSkill2.SetActive(false);
                quickSkill3.SetActive(false);
            }

            //If both an enemy and a player are selected
            if (battleController.selectedEnemy != -1)
            {
                //If it is actually an enemy during an attack
                if (battleController.selectedEnemy < battleController.enemies.Count && Battle.battleState == BattleState.Attack)
                {
                    float ed = (battleController.enemies[battleController.selectedEnemy].cHealth - battleController.GetDamageValues(battleController.players[battleController.selectedPlayer], battleController.enemies[battleController.selectedEnemy]).First) / (battleController.enemies[battleController.selectedEnemy].GetEffectiveStat(Stats.MaxHealth) * 1.0f);
                    if (ed >= 0.75)
                    {
                        damageNote1.text = "Enemy will probably just tank my hit.";
                    }
                    else if (ed >= 0.5)
                    {
                        damageNote1.text = "I should be able to do some damage.";
                    }
                    else if (ed >= 0.25)
                    {
                        damageNote1.text = "I can do some hefty damage.";
                    }
                    else
                    {
                        damageNote1.text = "This enemy will not live for much longer.";
                    }
                    float pd = (battleController.players[battleController.selectedPlayer].cHealth - battleController.GetDamageValues(battleController.enemies[battleController.selectedEnemy], battleController.players[battleController.selectedPlayer]).First) / (battleController.players[battleController.selectedPlayer].GetEffectiveStat(Stats.MaxHealth) * 1.0f);
                    if (battleController.enemies[battleController.selectedEnemy].GetWeaponStatsAtDistance(battleController.players[battleController.selectedPlayer].tempStats.position - battleController.enemies[battleController.selectedEnemy].tempStats.position) == null)
                    {
                        damageNote2.text = "And they shouldn't be able to counterattack me from this range.";
                    }
                    else if (pd >= 0.5)
                    {
                        damageNote2.text = "I should be fine if they counterattack.";
                    }
                    else if (pd >= 0.25)
                    {
                        damageNote2.text = "Their counterattack will definitely hurt though.";
                    }
                    else
                    {
                        damageNote2.text = "May the gods help me if they survive though.";
                    }
                    damageNote2.gameObject.SetActive(true);
                }
                //If it is actually a second player
                else if (battleController.selectedEnemy >= battleController.enemies.Count)
                {
                    damageNote1.text = "Healing is fun.";
                }
                damageNote1.gameObject.SetActive(true);
                confirmAttack.SetActive(true);
            }
        }
        else
        {
            playerStats.SetActive(false);
            confirmAttack.SetActive(false);
            quickSkill1.SetActive(false);
            quickSkill2.SetActive(false);
            quickSkill3.SetActive(false);
            damageNote1.gameObject.SetActive(false);
            damageNote2.gameObject.SetActive(false);
        }

        //If an enemy is selected
        if (battleController.selectedEnemy != -1)
        {
            enemyStats.SetActive(true);
            BattlePawnBase pawn = null;

            //If it is actually an enemy
            if (battleController.selectedEnemy < battleController.enemies.Count)
            {
                pawn = battleController.enemies[battleController.selectedEnemy];
            }

            //If it is actually a second player
            else
            {
                pawn = battleController.players[battleController.selectedEnemy - battleController.enemies.Count];
            }

            UpdateStats(pawn, enemyStats.GetComponentsInChildren <Text>());
        }
        else
        {
            enemyStats.SetActive(false);
            confirmAttack.SetActive(false);
            damageNote1.gameObject.SetActive(false);
            damageNote2.gameObject.SetActive(false);
        }
    }