Example #1
0
        public override void helpTo(Warriors we)
        {
            if (CDTime.isCoolDown())
            {
                return;
            }

            Warrior target = this;
            int     min    = this.attackDistance;

            for (int i = we.size() - 1; i >= 0; --i)
            {
                if (we.At(i) is Rescue)
                {
                    continue;
                }
                if (we.At(i).fullHP())
                {
                    continue;
                }
                if (this.distance(we.At(i)) <= min)
                {
                    min    = this.distance(we.At(i));
                    target = we.At(i);
                }
            }

            target.addHP(this.power);
            CDTime.record();
        }
        public PlayBoard(EnergyBar energy, Warriors group, int level, bool isMe = false)
        {
            this.isMe   = isMe;
            this.energy = energy;
            this.group  = group;
            this.level  = level;
            this.group.add(new Castle(this.level));

            this.fixValue = group.isReverse() ? 1 : -1;
            this.rand     = new Random();

            direct = rand.Next(0, level);
        }
Example #3
0
//attack to warriors
        public virtual void attackTo(Warriors they)
        {
            if (CDTime.isCoolDown() || they.size() == 0)
            {
                return;
            }

            if (this.distance(they.frontLine()) <= this.attackDistance)
            {
                changeStatusTo((int)Status.attack);
                they.frontGroup()[0].beAttackFrom(this);
                CDTime.record();
            }
        }
Example #4
0
        public override void attackTo(Warriors they)
        {
            if (CDTime.isCoolDown() || they.size() == 0)
            {
                return;
            }

            if (this.distance(they.frontLine()) <= this.attackDistance)
            {
                img.Image = myRealStatus[(int)Status.attack];
                attackGroup(they.frontGroup());
                CDTime.record();
            }
        }
Example #5
0
        public override void attackTo(Warriors they)
        {
            if (they.size() <= 1)
            {
                this.beKill();
                return;
            }

            if (this.distance(they.frontLine()) <= 0)
            {
                for (int i = 0; i < they.size(); ++i)
                {
                    if (distance(they.At(i)) < this.attackDistance)
                    {
                        they.At(i).beAttackFrom(this);
                    }
                }
            }
        }
        public BattleLine(PlayBoard ABoard, PlayBoard BBoard)
        {
            haveWinner = false;

            ABoard.mainLine = this;
            BBoard.mainLine = this;

            this.ABoard  = ABoard;
            this.BBoard  = BBoard;
            this.AEnergy = ABoard.energy;
            this.BEnergy = BBoard.energy;
            this.A       = ABoard.group;
            this.B       = BBoard.group;

            A.At(0).changeStatusTo((int)Status.move);
            B.At(0).changeStatusTo((int)Status.move);

            A.setEnemy(B);
            B.setEnemy(A);
        }
//
//Initation
//
        public BattleForm()
        {
            rand = new Random();

            this.DoubleBuffered = true; //圖形移動不閃爍
            this.Opacity        = 0.9;  //透明度

            InitializeComponent();
            battlePictureInit();
            this.Width        = Const.BStartPoint + 100;
            pictureBox1.Width = this.Width;

            A           = new Warriors(new Point(Const.AStartPoint), this);
            B           = new Warriors(new Point(Const.BStartPoint), this, true);
            myEnergyBar = new EnergyBar(10);
            aiEnergyBar = new EnergyBar(10);
            AI          = new PlayBoard(aiEnergyBar, B, Program.AI.level);
            Player      = new PlayBoard(myEnergyBar, A, Program.player.level, true);

            mainLine = new BattleLine(AI, Player);

            _warriorButtonList = new List <Button>();
        }
Example #8
0
 public void setEnemy(Warriors value)
 {
     this.enemy = value;
 }
Example #9
0
//help to partner
        public virtual void helpTo(Warriors we)
        {
            ;
        }