コード例 #1
0
        public HumanFighter(string name, int level, List <Spell> spells = null, List <SpecialMove> specialMoves = null)
            : base(name
                   , level
                   , LevelUpManager.GetHealthByLevel(level)
                   , LevelUpManager.GetManaByLevel(level)
                   , LevelUpManager.GetStrengthByLevel(level)
                   , LevelUpManager.GetDefenseByLevel(level)
                   , LevelUpManager.GetSpeedByLevel(level)
                   , LevelUpManager.GetEvadeByLevel(level)
                   , LevelUpManager.GetLuckByLevel(level)
                   , SpellFactory.GetSpellsByLevel <HumanFighter>(level)
                   , MoveFactory.GetMovesByLevel <HumanFighter>(level)
                   )
        {
            if (spells != null)
            {
                Spells.AddRange(spells);
            }

            if (specialMoves != null)
            {
                SpecialMoves.AddRange(specialMoves);
            }

            _extraSpecialMoves = new List <BattleMove>();
            CurrentExp         = LevelUpManager.GetExpForLevel(level);
            _expToNextLevel    = LevelUpManager.GetExpForLevel(level + 1);
        }
コード例 #2
0
ファイル: DancerBoss.cs プロジェクト: Jsweeney1000/SimpleRPG
 public DancerBoss(FighterClass fighterClass, int level, IChanceService chanceService)
     : base("",
            level,
            LevelUpManager.GetHealthByLevel <DancerBoss>(level, fighterClass),
            LevelUpManager.GetManaByLevel <DancerBoss>(level, fighterClass),
            LevelUpManager.GetStrengthByLevel <DancerBoss>(level, fighterClass),
            LevelUpManager.GetDefenseByLevel <DancerBoss>(level, fighterClass),
            LevelUpManager.GetSpeedByLevel <DancerBoss>(level, fighterClass),
            LevelUpManager.GetEvadeByLevel <DancerBoss>(level, fighterClass),
            LevelUpManager.GetLuckByLevel <DancerBoss>(level, fighterClass),
            chanceService,
            SpellFactory.GetSpellsByLevel <DancerBoss>(level, fighterClass: fighterClass)
            , MoveFactory.GetMovesByLevel <DancerBoss>(level, fighterClass: fighterClass))
 {
     if (fighterClass == FighterClass.BossDancerKiki)
     {
         BaseName = "Kiki";
     }
     else if (fighterClass == FighterClass.BossDancerRiki)
     {
         BaseName = "Riki";
     }
     else
     {
         throw new ArgumentOutOfRangeException(nameof(fighterClass), "DancerBoss class can only be initialized with Kiki or Riki fighter class!");
     }
 }
コード例 #3
0
 public Ogre(int level, IChanceService chanceService)
     : base("Ogre",
            level,
            LevelUpManager.GetHealthByLevel <Ogre>(level),
            LevelUpManager.GetManaByLevel <Ogre>(level),
            LevelUpManager.GetStrengthByLevel <Ogre>(level),
            LevelUpManager.GetDefenseByLevel <Ogre>(level),
            LevelUpManager.GetSpeedByLevel <Ogre>(level),
            LevelUpManager.GetEvadeByLevel <Ogre>(level),
            LevelUpManager.GetLuckByLevel <Ogre>(level),
            chanceService,
            SpellFactory.GetSpellsByLevel <Ogre>(level)
            , MoveFactory.GetMovesByLevel <Ogre>(level))
 {
 }
コード例 #4
0
ファイル: Barbarian.cs プロジェクト: Jsweeney1000/SimpleRPG
 public Barbarian(int level, IChanceService chanceService, string name = null) :
     base(name ?? "Barbarian"
          , level
          , LevelUpManager.GetHealthByLevel <Barbarian>(level)
          , LevelUpManager.GetManaByLevel <Barbarian>(level)
          , LevelUpManager.GetStrengthByLevel <Barbarian>(level)
          , LevelUpManager.GetDefenseByLevel <Barbarian>(level)
          , LevelUpManager.GetSpeedByLevel <Barbarian>(level)
          , LevelUpManager.GetEvadeByLevel <Barbarian>(level)
          , LevelUpManager.GetLuckByLevel <Barbarian>(level)
          , chanceService
          , SpellFactory.GetSpellsByLevel <Barbarian>(level)
          , MoveFactory.GetMovesByLevel <Barbarian>(level))
 {
     _shieldBusterFails = 0;
 }
コード例 #5
0
 public Zombie(int level, IChanceService chanceService)
     : base("Zombie",
            level,
            LevelUpManager.GetHealthByLevel <Zombie>(level),
            LevelUpManager.GetManaByLevel <Zombie>(level),
            LevelUpManager.GetStrengthByLevel <Zombie>(level),
            LevelUpManager.GetDefenseByLevel <Zombie>(level),
            LevelUpManager.GetSpeedByLevel <Zombie>(level),
            LevelUpManager.GetEvadeByLevel <Zombie>(level),
            LevelUpManager.GetLuckByLevel <Zombie>(level),
            chanceService,
            SpellFactory.GetSpellsByLevel <Zombie>(level)
            , MoveFactory.GetMovesByLevel <Zombie>(level))
 {
     ReviveCounter = 0;
     Killed        = _setReviveCounter;
     TurnEnded    += _turnEnded;
 }
コード例 #6
0
        /// <summary>
        /// Assumes CurrentExp has already been updated
        /// </summary>
        private void LevelUp()
        {
            var continuer = true;

            for (var i = Level + 1; i <= LevelUpManager.MAX_LEVEL && continuer; ++i)
            {
                if (CurrentExp >= LevelUpManager.GetExpForLevel(i))
                {
                    ++Level;

                    CurrentHealth = LevelUpManager.GetHealthByLevel(Level);
                    MaxHealth     = LevelUpManager.GetHealthByLevel(Level);
                    CurrentMana   = LevelUpManager.GetManaByLevel(Level);
                    MaxMana       = LevelUpManager.GetManaByLevel(Level);
                    Strength      = LevelUpManager.GetStrengthByLevel(Level);
                    Defense       = LevelUpManager.GetDefenseByLevel(Level);
                    Speed         = LevelUpManager.GetSpeedByLevel(Level);
                    Evade         = LevelUpManager.GetEvadeByLevel(Level);
                    Luck          = LevelUpManager.GetLuckByLevel(Level);

                    OnLeveledUp(new LeveledUpEventArgs(
                                    Level
                                    , LevelUpManager.HealthBoostByLevel(Level)
                                    , LevelUpManager.ManaBoostByLevel(Level)
                                    , LevelUpManager.StrengthBoostByLevel(Level)
                                    , LevelUpManager.DefenseBoostByLevel(Level)
                                    , LevelUpManager.SpeedBoostByLevel(Level)));

                    var spells = SpellFactory.GetSpellsByLevel <HumanFighter>(Level, Level);

                    if (spells.Count > 0)
                    {
                        AddSpells(spells);
                    }
                }
                else
                {
                    continuer = false;
                }
            }

            _expToNextLevel = LevelUpManager.GetExpForLevel(Level + 1);
        }
コード例 #7
0
ファイル: ShieldGuy.cs プロジェクト: Jsweeney1000/SimpleRPG
 public ShieldGuy(int level, IChanceService chanceService, string name = null) :
     base(name ?? "Shield Guy"
          , level
          , LevelUpManager.GetHealthByLevel <ShieldGuy>(level)
          , LevelUpManager.GetManaByLevel <ShieldGuy>(level)
          , LevelUpManager.GetStrengthByLevel <ShieldGuy>(level)
          , LevelUpManager.GetDefenseByLevel <ShieldGuy>(level)
          , LevelUpManager.GetSpeedByLevel <ShieldGuy>(level)
          , LevelUpManager.GetEvadeByLevel <ShieldGuy>(level)
          , LevelUpManager.GetLuckByLevel <ShieldGuy>(level)
          , chanceService
          , SpellFactory.GetSpellsByLevel <ShieldGuy>(level)
          , MoveFactory.GetMovesByLevel <ShieldGuy>(level))
 {
     _basicAttack    = AvailableMoves.FirstOrDefault(bm => bm.MoveType == BattleMoveType.Attack);
     _ironShieldMove = AvailableMoves.FirstOrDefault(bm => bm is ShieldMove) as ShieldMove;
     _healShield     = AvailableMoves.FirstOrDefault(bm => bm is ShieldFortifyingMove && ((ShieldFortifyingMove)bm).FortifyingType == ShieldFortifyingType.Health) as ShieldFortifyingMove;
     _fortifyShield  = AvailableMoves.FirstOrDefault(bm => bm is ShieldFortifyingMove && ((ShieldFortifyingMove)bm).FortifyingType == ShieldFortifyingType.Defense) as ShieldFortifyingMove;
 }
コード例 #8
0
        public void LevelInitializater_CorrectlyInitializesStatsBasedOnLevel([Values(1, 2, 5)] int level)
        {
            var fighter = new HumanFighter("Foo the Magnificent", level);

            Assert.AreEqual(level, fighter.Level);
            Assert.AreEqual(LevelUpManager.GetHealthByLevel(level), fighter.CurrentHealth);
            Assert.AreEqual(LevelUpManager.GetHealthByLevel(level), fighter.MaxHealth);
            Assert.AreEqual(LevelUpManager.GetManaByLevel(level), fighter.CurrentMana);
            Assert.AreEqual(LevelUpManager.GetManaByLevel(level), fighter.MaxMana);
            Assert.AreEqual(LevelUpManager.GetStrengthByLevel(level), fighter.Strength);
            Assert.AreEqual(LevelUpManager.GetDefenseByLevel(level), fighter.Defense);
            Assert.AreEqual(LevelUpManager.GetSpeedByLevel(level), fighter.Speed);
            Assert.AreEqual(LevelUpManager.GetEvadeByLevel(level), fighter.Evade);
            Assert.AreEqual(LevelUpManager.GetLuckByLevel(level), fighter.Luck);
            var spells = GetSpellsByLevel(level);

            Assert.AreEqual(spells.Count, fighter.Spells.Count);
            Assert.IsTrue(spells.TrueForAll(s => fighter.Spells.SingleOrDefault(fs => fs.Description == s.Description) != null));
        }
コード例 #9
0
ファイル: Shade.cs プロジェクト: Jsweeney1000/SimpleRPG
        public Shade(int level, IChanceService chanceService, int shadeExperience)
            : base("Shade",
                   level,
                   LevelUpManager.GetHealthByLevel <Shade>(level),
                   LevelUpManager.GetManaByLevel <Shade>(level),
                   LevelUpManager.GetStrengthByLevel <Shade>(level),
                   LevelUpManager.GetDefenseByLevel <Shade>(level),
                   LevelUpManager.GetSpeedByLevel <Shade>(level),
                   LevelUpManager.GetEvadeByLevel <Shade>(level),
                   LevelUpManager.GetLuckByLevel <Shade>(level),
                   chanceService,
                   SpellFactory.GetSpellsByLevel <Shade>(level)
                   , MoveFactory.GetMovesByLevel <Shade>(level))
        {
            ShadeExperience     = shadeExperience;
            _malevolenceCounter = 0;

            _chargeMove            = AvailableMoves.FirstOrDefault(bm => bm.MoveType == BattleMoveType.Special);
            _malevolenceAttackMove = AvailableMoves.FirstOrDefault(bm => bm.MoveType == BattleMoveType.ConditionalPowerAttack);
        }
コード例 #10
0
        public Warrior(int level, IChanceService chanceService, string name = null) :
            base(name ?? "Warrior"
                 , level
                 , LevelUpManager.GetHealthByLevel <Warrior>(level)
                 , LevelUpManager.GetManaByLevel <Warrior>(level)
                 , LevelUpManager.GetStrengthByLevel <Warrior>(level)
                 , LevelUpManager.GetDefenseByLevel <Warrior>(level)
                 , LevelUpManager.GetSpeedByLevel <Warrior>(level)
                 , LevelUpManager.GetEvadeByLevel <Warrior>(level)
                 , LevelUpManager.GetLuckByLevel <Warrior>(level)
                 , chanceService
                 , SpellFactory.GetSpellsByLevel <Warrior>(level)
                 , MoveFactory.GetMovesByLevel <Warrior>(level))
        {
            _attackIndex          = AvailableMoves.FindIndex(bm => bm.MoveType == BattleMoveType.Attack);
            _evadeIndex           = AvailableMoves.FindIndex(bm => bm.MoveType == BattleMoveType.Status && (bm as StatusMove)?.Status is AutoEvadeStatus && !((AutoEvadeStatus)((StatusMove)bm).Status).ShouldCounterAttack);
            _evadeAndCounterIndex = AvailableMoves.FindIndex(bm => bm.MoveType == BattleMoveType.Status && (bm as StatusMove)?.Status is AutoEvadeStatus && ((AutoEvadeStatus)((StatusMove)bm).Status).ShouldCounterAttack);
            _attackBoostIndex     = AvailableMoves.FindIndex(bm => bm.MoveType == BattleMoveType.Status && (bm as StatusMove)?.Status is StatMultiplierStatus);

            _attackBoostMove = AvailableMoves[_attackBoostIndex] as StatusMove;
        }
コード例 #11
0
ファイル: MegaChicken.cs プロジェクト: Jsweeney1000/SimpleRPG
        public MegaChicken(int level, IChanceService chanceService)
            : base("Mega Chicken",
                   level,
                   LevelUpManager.GetHealthByLevel <MegaChicken>(level),
                   LevelUpManager.GetManaByLevel <MegaChicken>(level),
                   LevelUpManager.GetStrengthByLevel <MegaChicken>(level),
                   LevelUpManager.GetDefenseByLevel <MegaChicken>(level),
                   LevelUpManager.GetSpeedByLevel <MegaChicken>(level),
                   LevelUpManager.GetEvadeByLevel <MegaChicken>(level),
                   LevelUpManager.GetLuckByLevel <MegaChicken>(level),
                   chanceService,
                   SpellFactory.GetSpellsByLevel <MegaChicken>(level)
                   , MoveFactory.GetMovesByLevel <MegaChicken>(level))
        {
            MagicStrength = 3;

            ExpGivenOnDefeat = 20 + level * 5;

            _layEgg   = new SpecialMove("lay egg", BattleMoveType.Special, TargetType.Self, null);
            _lay2Eggs = new SpecialMove("lay 2 eggs", BattleMoveType.Special, TargetType.Self, null);
            _castEggs = new SpecialMove("cast eggs", BattleMoveType.Special, TargetType.Self, null);
            _eggs     = new List <Egg>();
        }
コード例 #12
0
        public void GainExpMethod_AppropriatelyRaisesLevel([Values(2, 4)] int level)
        {
            var expAmount = (level == 2) ? _expToLevel2 : _expToLevel4;

            Assert.AreEqual(0, _fighter.CurrentExp);

            _fighter.GainExp(expAmount);

            Assert.AreEqual(expAmount, _fighter.CurrentExp);
            Assert.AreEqual(level, _fighter.Level);
            Assert.AreEqual(LevelUpManager.GetHealthByLevel(level), _fighter.CurrentHealth);
            Assert.AreEqual(LevelUpManager.GetHealthByLevel(level), _fighter.MaxHealth);
            Assert.AreEqual(LevelUpManager.GetManaByLevel(level), _fighter.CurrentMana);
            Assert.AreEqual(LevelUpManager.GetManaByLevel(level), _fighter.MaxMana);
            Assert.AreEqual(LevelUpManager.GetStrengthByLevel(level), _fighter.Strength);
            Assert.AreEqual(LevelUpManager.GetDefenseByLevel(level), _fighter.Defense);
            Assert.AreEqual(LevelUpManager.GetSpeedByLevel(level), _fighter.Speed);
            Assert.AreEqual(LevelUpManager.GetEvadeByLevel(level), _fighter.Evade);
            Assert.AreEqual(LevelUpManager.GetLuckByLevel(level), _fighter.Luck);
            var spells = GetSpellsByLevel(level);

            Assert.AreEqual(spells.Count, _fighter.Spells.Count);
            Assert.IsTrue(spells.TrueForAll(s => _fighter.Spells.SingleOrDefault(fs => fs.Description == s.Description) != null));
        }