コード例 #1
0
        public void attack(Entity target)
        {
            if (playerTurn)
            {
                int AttackScore = this.friend.basicAttackHit();
                int dodge = target.dodge();

                // MessageBox.Show("First: " + AttackScore + " Second:" + dodge);
                if (AttackScore > dodge)
                {
                    int damage = this.friend.basicAttackDamage();
                    target.takeDamage(damage);
                    this.dataOut = "You hit " + target.name + " for " + damage + " damage!\r\n";
                }
                else
                {
                    this.dataOut = "You Missed!\r\n";
                }
                //foe = target;

                foes[target.getInstanceID()] = target;

            }
            else
            {
                this.foe = foes[TurnOrder[turnID]];
                if (this.foe.isAlive())
                {
                    int AttackScore = this.foe.basicAttackHit();
                    int dodge = target.dodge();
                    if (AttackScore > dodge)
                    {
                        int damage = this.foe.basicAttackDamage();
                        target.takeDamage(damage);
                        this.dataOut = foe.name + " hit you for " + damage + " damage!\r\n";
                    }
                    else
                    {
                        this.dataOut = foe.name + " Missed!\r\n";
                    }
                    friend = target;
                }
                else
                {
                    this.dataOut = "";
                }
            }
        }
コード例 #2
0
        private List<int> TurnOrder = new List<int>(); //List of InstanceIDs

        #endregion Fields

        #region Constructors

        public BattleV2(Party playerParty, Party foeParty)
        {
            this.friend = playerParty.getActiveParty()[0];
            this.friend.setInstanceID(nextID);
            nextID++;
            //this.TurnOrder.Add(this.friend.getInstanceID());

            foreach (Entity tmpFoe in foeParty.getActiveParty())
            {
                tmpFoe.setInstanceID(nextID);
                //this.TurnOrder.Add(tmpFoe.getInstanceID());
                foes.Add(tmpFoe.getInstanceID(), tmpFoe);
                nextID++;
            }
            this.foe = foeParty.getActiveParty()[0];
            this.dataOut = "You, " + this.friend.name + ", have encountered a level " + this.foe.getLevel() + " " + this.foe.name + "\r\n";
            OrderParicipents();
        }