コード例 #1
0
ファイル: Ninja.cs プロジェクト: Revolver-Koala/cs-class-demo
        public override string Attack(PlayerCharacter pl)
        {
            var damage = pl.Damaged(AttackPower);

            return this.Name + " ninja chopped " + pl.Name +
                " and dealt " + damage + " HP of damage!";
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: Revolver-Koala/cs-class-demo
        public FrmBattle()
        {
            InitializeComponent();

            _monsters = new List<Monster>();

            _monsters.Add(new Knight("Sir Cliffy"));

            _monsters.Add(new Ninja("Ninja 1"));

            _monsters.Add(new Ogre("Ogre 1"));

            _pc = new PlayerCharacter("Adventurer Bob", 400, 45);

            txtPlayerName.Text = _pc.Name;
            txtPlayerHP.Text = _pc.HitPoints.ToString();
            txtPlayerAtk.Text = _pc.AttackPower.ToString();

            txtMonsterNameA.Text = _monsters.First().Name;
            txtMonsterHpA.Text = _monsters.First().HitPoints.ToString();
            txtMonsterAtkA.Text = _monsters.First().AttackPower.ToString();
        }
コード例 #3
0
 public override string Attack(PlayerCharacter pl)
 {
     return this.Name + " slashed you with their sword for " + pl.Damaged(this.AttackPower)
         + " points of damage!";
     //return base.Attack(pl);
 }
コード例 #4
0
        public virtual string Attack(PlayerCharacter pl)
        {
            var damage = pl.Damaged(AttackPower);

            return "The monster attacked you for " + damage + " points of damage!";
        }
コード例 #5
0
 public override string Attack(PlayerCharacter pl)
 {
     return(this.Name + " slashed you with their sword for " + pl.Damaged(this.AttackPower)
            + " points of damage!");
     //return base.Attack(pl);
 }