public SelectEnemyFighterMenuSelection(FighterType fighterType, int fighterLevel, BattleConfigurationSpecialFlag flag)
     : base(string.Empty, null, null)
 {
     FighterType  = fighterType;
     FighterLevel = fighterLevel;
     SpecialFlag  = flag;
 }
Example #2
0
        public EnemyFighter(Point startPos, FighterType fighterType) : base(startPos)
        {
            _fighterType = fighterType;
            switch (fighterType)
            {
            case  FighterType.RED:
                PlaneImg = Resource.fighterRed;
                OFFSET  += 4;
                break;

            case  FighterType.GREEN:
                PlaneImg = Resource.fighterGreen; break;

            case  FighterType.YELLOW:
                PlaneImg = Resource.fighterYellow;
                OFFSET  += 2;
                break;

            default:
                break;
            }
            AutoMove  = true;
            IsEnemy   = true;
            OFFSET    = 4;
            PlaneSize = new Size(PlaneImg.Width, PlaneImg.Height);
        }
Example #3
0
        public void GetTeamByConfiguration_ReturnsAppropriateTeam([Values(FighterType.Fairy, FighterType.Goblin, FighterType.Warrior)] FighterType firstFighterType,
                                                                  [Range(1, 3)] int numberFirstFighters,
                                                                  [Values(1, 2)] int enemyLevel,
                                                                  [Values(FighterType.Ogre, FighterType.Golem)] FighterType secondFighterType)
        {
            List <EnemyConfiguration> enemyConfigurations = new List <EnemyConfiguration>();

            int i;

            for (i = 0; i < numberFirstFighters; ++i)
            {
                enemyConfigurations.Add(new EnemyConfiguration(firstFighterType, enemyLevel));
            }
            enemyConfigurations.Add(new EnemyConfiguration(secondFighterType, enemyLevel));

            TeamConfiguration configuration = new TeamConfiguration(enemyConfigurations.ToArray());

            Team returnedTeam = _teamFactory.GetTeam(configuration);

            Assert.AreEqual(numberFirstFighters + 1, returnedTeam.Fighters.Count);

            Assert.IsTrue(returnedTeam.Fighters.TrueForAll(f => f.Level == enemyLevel));

            for (i = 0; i < numberFirstFighters; ++i)
            {
                Assert.IsTrue(firstFighterType.IsCorrectType(returnedTeam.Fighters[i]));
            }
            Assert.IsTrue(secondFighterType.IsCorrectType(returnedTeam.Fighters[i]));
        }
Example #4
0
        /// <summary>
        ///     Функция для добавления солдат в отряд
        /// </summary>
        /// <param name="fighterType">Тип бойца</param>
        /// <param name="count">Количество добавляемых бойцов</param>
        public void AddFighters(FighterType fighterType, int count)
        {
            int lastIndex = FindLastNull();

            switch (fighterType)
            {
            case FighterType.Samurai:
                for (int i = 0; i < count; i++)
                {
                    this[lastIndex + i] = Samurai.GenerateNewFighter(isPlayerSquad, lastIndex + i);
                }
                break;

            case FighterType.Ninja:
                for (int i = 0; i < count; i++)
                {
                    this[lastIndex + i] = Ninja.GenerateNewFighter(isPlayerSquad, lastIndex + i);
                }
                break;

            case FighterType.Fighter:
                for (int i = 0; i < count; i++)
                {
                    this[lastIndex + i] = Fighter.GenerateNewFighter(isPlayerSquad, lastIndex + i);
                }
                break;
            }
        }
        public void ConstructorInitializesExpGiven([Values(FighterType.Fairy, FighterType.Goblin, FighterType.Golem, FighterType.Ogre)] FighterType type,
                                                   [Values(1, 2, 3)] int level)
        {
            var fighter = (EnemyFighter)FighterFactory.GetFighter(type, level);

            Assert.AreEqual(level * 5, fighter.ExpGivenOnDefeat);
        }
Example #6
0
        public void GetWinnerInWar_Returns_Barbarian_As_Winner_If_1_Cannon_Vs_10_Barbarian_In_War()
        {
            WarCreator  warCreator = new WarCreator(1, 10);
            FighterType winner     = warCreator.GetWinnerInWar();

            Assert.Equal(FighterType.Barbarian, winner);
        }
Example #7
0
    private void InstantiateFighter(
        bool first,
        Fighter fighter_prefab,
        ref Fighter fightdata_fighter,
        FighterType fighter_type,
        Transform spawn_point,
        float offset
        )
    {
        Debug.Assert(fighter_prefab != null);

        float direction = first ? 1 : -1;

        fightdata_fighter = Instantiate(
            fighter_prefab,
            spawn_point.position + offset * spawn_point.right * direction,
            spawn_point.rotation
            ) as Fighter;

        float angle = first ? 270 : 90;

        fightdata_fighter.transform.Rotate(Vector3.up, angle);

        switch (fighter_type)
        {
        case FighterType.Enemy:
            fightdata_fighter.gameObject.AddComponent <FighterAI>();
            break;

        case FighterType.Player:
            Player player_component = fightdata_fighter.gameObject.AddComponent <Player>();
            player_component.player_index = first ? Player.PlayerIndex.Player1 : Player.PlayerIndex.Player2;
            break;
        }
    }
    private void HandleHealthEmptiedEvent(FighterType fighterName)
    {
        FighterType winner = (fighterName == FighterType.Enemy) ? FighterType.Player : FighterType.Enemy;

        MenuManager.GoToMenu(MenuName.Gameover);
        GameObject GOM = GameObject.FindGameObjectWithTag("GameoverMenu");

        GOM.GetComponent <GameoverMenu>().Winner = winner;
    }
Example #9
0
    public void InitializeFromFighterType(FighterType newFT)
    {
        ft          = newFT;
        fighterType = ft.fighterTypeName;
        health      = ft.maxHealth;
        energy      = ft.maxEnergy;
        fighterName = Guid.NewGuid().ToString().Substring(0, 8);
        team        = "team-" + fighterName;

        GetComponent <SpriteRenderer>().sprite = ft.skinBody;
    }
Example #10
0
    /// <summary>
    /// Marks damage in player health
    /// </summary>
    private void HandleDamageMadeEvent(float damageAmount, FighterType fighterDamaged)
    {
        // take damage
        HealthBar healthBar = healthBars[fighterDamaged];

        healthBar.TakeDamage(damageAmount);
        // if empty invoke event
        if (healthBar.Value <= 0)
        {
            healthEmptiedEvent.Invoke(fighterDamaged);
        }
    }
Example #11
0
        public async Task <IEnumerable <string> > GetFightersIdsByTypeAsync(FighterType type)
        {
            var query = new Query(Kind)
            {
                Filter     = Filter.Equal("type", type.ToString().ToLower()),
                Projection = { "__key__" }
            };

            var queryResults = await _db.RunQueryAsync(query);

            return(queryResults.Entities.Select(entity => entity.Key.Path[0].Name).ToList());
        }
Example #12
0
        public Fighter(FighterType type, Fight fight)
        {
            myType  = type;
            myFight = fight;

            Buffs           = new FighterBuff();
            SpellController = new FighterSpell();

            Left       = false;
            FightReady = false;
            TurnReady  = false;
        }
Example #13
0
    public override void OnStartClient()
    {
        if (NetworkServer.active)
        {
            return;
        }

        FighterType found = FighterTypeManager.Lookup(fighterType);

        ft = found;
        GetComponent <SpriteRenderer>().sprite = ft.skinBody;
    }
Example #14
0
        public Fighter(FighterType type, Fight fight)
        {
            myType = type;
            myFight = fight;

            Buffs = new FighterBuff();
            SpellController = new FighterSpell();

            Left = false;
            FightReady = false;
            TurnReady = false;
        }
Example #15
0
        private static BaseFight GetFighter(FighterType type)
        {
            switch (type)
            {
                case FighterType.EugeneFighter:
                    return new EugeneFighter();

                case FighterType.AlexandrFighter:
                    return new AlexandrFighter();

                default:
                    throw new Exception("Нет такого бойца, УХОДИ!");
            }
        }
        static public Fighter GetFighter(FighterType fighterType)
        {
            switch (fighterType)
            {
            case FighterType.MyFighter:
                return(MyFighter.Instance);

            case FighterType.EnemyFighter:
                return(new EnemyFighter());

            default:
                return(null);
            }
        }
Example #17
0
        private EnemyFighter GetEnemy(SubRegion region)
        {
            //FighterType[] types = regionFighterTypesDictionary[region.AreaId];
            //var length = types.Length;
            //var odds = new double[length];

            //for (var i = 0; i < length; ++i)
            //{
            //    odds[i] = (1.0/length);
            //}

            FighterType selectedFighterType = _chanceService.WhichEventOccurs(region.EnemyTypes);

            return((EnemyFighter)FighterFactory.GetFighter(selectedFighterType, 1));
        }
    // Start is called before the first frame update
    void Awake()
    {
        battleActionPoints  = baseActionPoints;
        battleLifePoints    = baseLifePoints;
        battleDefensePoints = baseDefensePoints;
        battleAttackPoints  = baseAttackPoints;

        if (gameObject.CompareTag("Player"))
        {
            fighterType = FighterType.Player;
        }
        if (gameObject.CompareTag("Enemy"))
        {
            fighterType = FighterType.Enemy;
        }
    }
Example #19
0
    public void HandleHealthEmptiedEvent(FighterType fighterEmptied)
    {
        switch (fighterEmptied)
        {
        case FighterType.Enemy:
            AudioManager.Play(AudioClipName.Victory);
            break;

        case FighterType.Player:
            AudioManager.Play(AudioClipName.Die);
            break;
        }
        if (fighterEmptied == fighterType)
        {
            Destroy(gameObject);
        }
    }
    // HELPER FUNCTIONS
    public void CopyEnemyData(Enemy inEnemy)
    {
        id        = inEnemy.GetID();
        enemyType = inEnemy.GetEnemyType();
        moves     = inEnemy.GetMoves();
        alive     = inEnemy.GetAlive();
        sprite    = inEnemy.GetSprite();
        name      = inEnemy.GetName();

        if (inEnemy.GetLevelUp() == false)
        {
            level        = inEnemy.GetLevel();
            baseStrength = inEnemy.GetBaseStrength();
            rateStrength = inEnemy.GetRateStrength();
            strength     = inEnemy.GetStrength();

            baseDexterity = inEnemy.GetBaseDexterity();
            rateDexterity = inEnemy.GetRateDexterity();
            dexterity     = inEnemy.GetDexterity();

            baseIntelligence = inEnemy.GetBaseIntelligence();
            rateIntelligence = inEnemy.GetRateIntelligence();
            intelligence     = inEnemy.GetIntelligence();

            totalPoints = inEnemy.GetTotalPoints();

            speed    = inEnemy.GetSpeed();
            attack   = inEnemy.GetAttack();
            defense  = inEnemy.GetDefense();
            accuracy = inEnemy.GetAccuracy();
            cooldown = inEnemy.GetCooldown();

            maxHealth     = inEnemy.GetMaxHealth();
            currentHealth = inEnemy.GetCurrentHealth();

            experienceNeeded = inEnemy.GetExperienceNeeded();
            experienceGained = inEnemy.GetExperienceGained();
        }
        else
        {
            LevelUp();
            levelUp = false;
        }
    }
Example #21
0
    public void CopyPlayerProperties(PlayerProperties inPlayer)
    {
        sprite = inPlayer.GetSprite();

        alive      = inPlayer.GetAlive();
        playerType = inPlayer.GetPlayerType();
        moves      = inPlayer.GetMoves();

        level   = inPlayer.GetLevel();
        levelUp = inPlayer.GetLevelUp();

        baseStrength = inPlayer.GetBaseStrength();
        rateStrength = inPlayer.GetRateStrength();
        strength     = inPlayer.GetStrength();

        baseDexterity = inPlayer.GetBaseDexterity();
        rateDexterity = inPlayer.GetRateDexterity();
        dexterity     = inPlayer.GetDexterity();

        baseIntelligence = inPlayer.GetBaseIntelligence();
        rateIntelligence = inPlayer.GetRateIntelligence();
        intelligence     = inPlayer.GetIntelligence();

        totalPoints = inPlayer.GetTotalPoints();

        speed    = inPlayer.GetSpeed();
        attack   = inPlayer.GetAttack();
        defense  = inPlayer.GetDefense();
        accuracy = inPlayer.GetAccuracy();
        cooldown = inPlayer.GetCooldown();

        maxHealth     = inPlayer.GetMaxHealth();
        currentHealth = inPlayer.GetCurrentHealth();

        experienceNeeded = inPlayer.GetExperienceNeeded();
        experienceGained = inPlayer.GetExperienceGained();

        updated = true;
    }
    // CONSTRUCTORS
    public EnemyProperties(int inID, FighterType inType, Moves inMoves, Sprite inSprite, string inName, bool inAlive, int inLevel, int inStrength, float inRateStrength, int inDexterity, float inRateDexterity, int inIntelligence, float inRateIntelligence)
    {
        id        = inID;
        enemyType = inType;
        moves     = inMoves;
        sprite    = inSprite;
        name      = inName;

        alive   = inAlive;
        level   = inLevel;
        levelUp = false;

        baseStrength = inStrength;
        rateStrength = inRateStrength;
        strength     = MainStatCalc(baseStrength, rateStrength);

        baseDexterity = inDexterity;
        rateDexterity = inRateDexterity;
        dexterity     = MainStatCalc(baseDexterity, rateDexterity);

        baseIntelligence = inIntelligence;
        rateIntelligence = inRateIntelligence;
        intelligence     = MainStatCalc(baseIntelligence, rateIntelligence);

        totalPoints = TotalPointsCalc();

        speed    = SpeedCalc();
        attack   = AttackCalc();
        defense  = DefenseCalc();
        accuracy = AccuracyCalc();
        cooldown = CooldownCalc();

        maxHealth     = HealthCalc();
        currentHealth = maxHealth;

        experienceNeeded = ExperienceNeededCalc();
        experienceGained = 0;
    }
Example #23
0
        protected override MenuSelection GetSubMenuInput(IMenu subMenu, MenuAction selectedAction)
        {
            NumberInputMenuSelection numberInputSelection = subMenu.GetInput() as NumberInputMenuSelection;

            if (numberInputSelection == null)
            {
                throw new InvalidOperationException("SelectEnemyFighterMenu's action's subMenu did not return a MenuAction of type NumberInputMenuSelection");
            }

            TypedMenuAction <BattleConfigurationSpecialFlag> typedSelectedAction =
                selectedAction as TypedMenuAction <BattleConfigurationSpecialFlag>;

            if (typedSelectedAction == null)
            {
                throw new InvalidOperationException("SelectEnemyFighterMenu should have initialized its menu actions as TypedMenuAction<BattleConfigurationSpecialFlags>");
            }

            FighterType selectedType = (FighterType)Enum.Parse(typeof(FighterType), selectedAction.CommandText);

            var menuSelection = new SelectEnemyFighterMenuSelection(selectedType, numberInputSelection.Number, typedSelectedAction.Item);

            return(menuSelection);
        }
Example #24
0
 public EnemyConfiguration(FighterType enemyType, int level, MagicType magicType = MagicType.None)
 {
     EnemyType = enemyType;
     Level     = level;
     MagicType = magicType;
 }
Example #25
0
 public NullFighterObject(int x, int y, FighterType type, FighterState state) : base(x, y, new NullFighter(), state)
 {
     this.type = type;
 }
        public static bool IsCorrectType(this FighterType expectedType, IFighter fighter)
        {
            bool isCorrectType;

            switch (expectedType)
            {
            case FighterType.Fairy:
                isCorrectType = fighter is Fairy;
                break;

            case FighterType.Goblin:
                isCorrectType = fighter is Goblin;
                break;

            case FighterType.Warrior:
                isCorrectType = fighter is Warrior;
                break;

            case FighterType.Ogre:
                isCorrectType = fighter is Ogre;
                break;

            case FighterType.Golem:
                isCorrectType = fighter is Golem;
                break;

            case FighterType.HumanControlledPlayer:
                isCorrectType = fighter is HumanFighter;
                break;

            case FighterType.HumanControlledEnemy:
                isCorrectType = fighter is HumanControlledEnemyFighter;
                break;

            case FighterType.MegaChicken:
                isCorrectType = fighter is MegaChicken;
                break;

            case FighterType.Egg:
                isCorrectType = fighter is Egg;
                break;

            case FighterType.DancerBoss:
                isCorrectType = fighter is DancerBoss;
                break;

            case FighterType.Zombie:
                isCorrectType = fighter is Zombie;
                break;

            case FighterType.ShieldGuy:
                isCorrectType = fighter is ShieldGuy;
                break;

            case FighterType.Barbarian:
                isCorrectType = fighter is Barbarian;
                break;

            default:
                throw new ArgumentException($"IsCorrectType() was not implemented to handle fighter type {expectedType}");
            }

            return(isCorrectType);
        }
		public static FighterInfo createMonsterProp(int index, Template.Auto.Monster.MonsterTemplate monsterTemp, BattleSideEnum battleSide, FighterType type, bool boss)
		{
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final java.util.Map<Integer, Integer> _aProp = createMonsterAProp(monsterTemp, boss);
			Dictionary<int, int> _aProp = createMonsterAProp(monsterTemp, boss);
			FighterInfo _info = FighterInfoCreater.createFighterProp(index, battleSide, type, _aProp);
			_info.addNormalProp(BattleKeyConstants.BATTLE_KEY_HERO_TEMPLATE, monsterTemp.Id); // 测试代码很糙请无视
			_info.addNormalProp(BattleKeyConstants.BATTLE_KEY_HERO_JOB, 0);
			_info.addNormalProp(BattleKeyConstants.BATTLE_PROP_MONSTER_AI_ID, monsterTemp.AiID);
			_info.addNormalProp(BattleKeyConstants.BATTLE_PROP_MONSTER_DEFAULT_CD, monsterTemp.CD);
			return _info;
		}
Example #28
0
 public Fighter(int damagePerHit, int capacity, FighterType fighterType)
 {
     DamagePerHit = damagePerHit;
     Capacity     = capacity;
     FighterType  = fighterType;
 }
Example #29
0
 public void SetEnemyType(FighterType inEnemyType)
 {
     enemyType = inEnemyType;
 }
        public void CorrectlyMovesToNextSubRegion_MultipleNextSubRegions([Values(1, 2)] int selectedArea)
        {
            const int groupingId = 10;

            _decisionManager.SetGroupingChoice(selectedArea - 1);
            TeamConfiguration firstBossConfiguration = new TeamConfiguration(new EnemyConfiguration(FighterType.Egg, 1, MagicType.Fire));
            SubRegion         firstSubRegion         = new SubRegion(WorldSubRegion.Fields, 0, new ChanceEvent <int> [0], new FighterType[0], new BattlefieldConfiguration(firstBossConfiguration));

            FighterType       bossA   = FighterType.Barbarian;
            WorldSubRegion    regionA = WorldSubRegion.DesertCrypt;
            TeamConfiguration secondBossConfiguration = new TeamConfiguration(new EnemyConfiguration(bossA, 1));
            SubRegion         subRegionA = new SubRegion(regionA, 0, new ChanceEvent <int> [0], new FighterType[0], new BattlefieldConfiguration(secondBossConfiguration));

            FighterType       bossB   = FighterType.MegaChicken;
            WorldSubRegion    regionB = WorldSubRegion.Oasis;
            TeamConfiguration thirdBossConfiguration = new TeamConfiguration(new EnemyConfiguration(bossB, 1));
            SubRegion         subRegionB             = new SubRegion(regionB, 0, new ChanceEvent <int> [0], new FighterType[0], new BattlefieldConfiguration(thirdBossConfiguration));

            SubRegion[] subRegions = { firstSubRegion, subRegionA, subRegionB };

            Region fakeFieldsRegion = new Region(WorldRegion.Fields, new BattleMove[0], subRegions);

            _regionFactory.SetRegion(WorldRegion.Fields, fakeFieldsRegion);

            AreaMap <Region, WorldRegion> regionMap = new AreaMap <Region, WorldRegion>(fakeFieldsRegion, new MapPath <Region, WorldRegion>(fakeFieldsRegion));

            MapGrouping <SubRegion, WorldSubRegion> grouping = new MapGrouping <SubRegion, WorldSubRegion>(groupingId, subRegionA, subRegionB);

            AreaMap <SubRegion, WorldSubRegion> subRegionMap = new AreaMap <SubRegion, WorldSubRegion>(firstSubRegion, new MapPath <SubRegion, WorldSubRegion>(firstSubRegion, grouping));

            _mapManager.SetRegionalMap(regionMap);
            _mapManager.SetSubRegionalMap(WorldRegion.Fields, subRegionMap);

            _regionManager = GetRegionManager();

            TestEnemyFighter target = (TestEnemyFighter)TestFighterFactory.GetFighter(TestFighterType.TestEnemy, 1);

            target.SetHealth(1, 0);

            _humanFighter1.SetMove(_basicAttackMove, 1);
            _humanFighter1.SetMove(_runawayMove, 1);
            _humanFighter1.SetMoveTarget(target);

            _humanFighter2.SetMove(_doNothingMove);

            _chanceService.PushAttackHitsNotCrit();

            _regionManager.Battle(_battleManager, _humanTeam);

            List <Team> enemyTeams = _battleManager.GetAllEnemyTeams();

            Assert.AreEqual(2, enemyTeams.Count);

            IFighter secondBoss = enemyTeams[1].Fighters[0];

            FighterType    selectedBossType   = selectedArea == 1 ? bossA : bossB;
            WorldSubRegion selectedBossRegion = selectedArea == 1 ? regionA : regionB;

            Assert.NotNull(secondBoss);
            Assert.True(selectedBossType.IsCorrectType(secondBoss));
            Assert.AreEqual(selectedBossRegion, subRegionMap.CurrentArea.AreaId);
        }
Example #31
0
		public static List<FighterInfo> createTestFighterList(int count, BattleSideEnum side, FighterType type)
		{
			List<FighterInfo> _fighterList = new List<FighterInfo>();
			for (int _i = 0; _i < count; _i++)
			{
				_fighterList.Add(createPropFromTest(_i, side, type, _i == count - 1));
			}
			return _fighterList;
		}
Example #32
0
		public static FighterInfo createPropFromTest(int index, BattleSideEnum battleSide, FighterType type, bool boss)
		{
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final java.util.Map<Integer, Integer> _aProp = createTestAProp(type.isHero(), boss);
			Dictionary<int, int> _aProp = createTestAProp(type.Hero, boss);
			FighterInfo _info = createFighterProp(index, battleSide, type, _aProp);
			_info.addNormalProp(BattleKeyConstants.BATTLE_KEY_HERO_TEMPLATE, 111001); // 测试代码很糙请无视
			_info.addNormalProp(BattleKeyConstants.BATTLE_KEY_HERO_JOB, 1);
			return _info;
		}
Example #33
0
		public static FighterInfo createFighterProp(int index, BattleSideEnum side, FighterType type, Dictionary<int, int> prop)
		{
			FighterInfo _info = new FighterInfo();
			_info.Index = index;
			_info.BattleProperty = prop;
			_info.BattleSide = side;
			_info.FighterType = type;
			return _info;
		}
 // SETTERS
 public void SetPlayerType(FighterType inType)
 {
     playerType = inType;
 }
Example #35
0
        public static IFighter GetFighter(FighterType type,
                                          int level,
                                          string name               = null,
                                          MagicType magicType       = MagicType.None,
                                          FighterClass fighterClass = FighterClass.None,
                                          IMenuFactory menuFactory  = null)
        {
            IFighter ret;

            switch (type)
            {
            case FighterType.Goblin:
                ret = new Goblin(level, ChanceService);
                break;

            case FighterType.Golem:     //high defense, low attack, low speed, low health
                ret = new Golem(level, ChanceService);
                break;

            case FighterType.Ogre:     //high attack, low speed, low defense
                ret = new Ogre(level, ChanceService);
                break;

            case FighterType.Fairy:     //high speed, high evade, low attack, low defense
                ret = new Fairy(level, ChanceService);
                break;

            case FighterType.HumanControlledPlayer:
                ret = new HumanFighter(name ?? "Player", level);
                GodRelationshipManager?.InitializeForFighter((HumanFighter)ret);
                break;

            case FighterType.HumanControlledEnemy:
                ret = new HumanControlledEnemyFighter(name ?? "Player", Input, Output, menuFactory ?? Globals.MenuFactory);
                break;

            case FighterType.MegaChicken:
                ret = new MegaChicken(level, ChanceService);
                break;

            case FighterType.Egg:
                if (magicType == MagicType.None)
                {
                    int magicIndex = ChanceService.WhichEventOccurs(Globals.EggMagicTypes.Length);
                    magicType = Globals.EggMagicTypes[magicIndex];
                }
                ret = new Egg(magicType);
                break;

            case FighterType.DancerBoss:
                ret = new DancerBoss(fighterClass, level, ChanceService);
                break;

            case FighterType.Zombie:
                ret = new Zombie(level, ChanceService);
                break;

            case FighterType.Warrior:
                ret = new Warrior(level, ChanceService);
                break;

            case FighterType.ShieldGuy:
                ret = new ShieldGuy(level, ChanceService);
                break;

            case FighterType.Barbarian:
                ret = new Barbarian(level, ChanceService);
                break;

            case FighterType.Shade:
                ret = GetShade(level, name);
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(type), type,
                                                      "The specified type is invalid for FighterFactory to initialize!");
            }

            return(ret);
        }
Example #36
0
        public async Task <string> SaveFighterAsync(Fighter fighter, Stream image, string contentType, FighterType type)
        {
            var fighterId = Guid.NewGuid().ToString();

            await _storage.UploadObjectAsync(_bucketName,
                                             fighterId,
                                             contentType,
                                             image,
                                             new UploadObjectOptions { PredefinedAcl = PredefinedObjectAcl.PublicRead });

            var entity = new Entity
            {
                Key      = _keyFactory.CreateKey(fighterId),
                ["name"] = fighter.Name,
                ["type"] = type.ToString().ToLower(),
                ["vote"] = 0
            };

            using (var transaction = await _db.BeginTransactionAsync())
            {
                transaction.Upsert(entity);
                await transaction.CommitAsync();
            }

            return(fighterId);
        }
Example #37
0
		public virtual List<FighterInfo> getTypeFighter(FighterType fighterType)
		{
			List<FighterInfo> _typeFighters = new List<FighterInfo>();
			foreach (FighterInfo _prop in FighterProp)
			{
				if (_prop.fighterType == fighterType)
				{
					_typeFighters.Add(_prop);
				}
			}
			return _typeFighters;
		}