public static BattleChessField GetBattleChessField(ChessFieldColor color, int enemyId, int count) { BattleChessField field = new BattleChessField(); field.Color = color; field.IsOpened = false; field.Count = count; field.EnemyAnger = 0; field.EnemyPlayerId = enemyId; HeroTeamLogic heroTeam = new HeroTeamLogic(); heroTeam.SetUser(field.EnemyPlayerId); PlayerHeroLogic playerHero = new PlayerHeroLogic(); playerHero.SetUser(field.EnemyPlayerId); int i = 0; foreach (int heroId in heroTeam.MyHeroTeam.Team) { if (heroId == 0) { break; } field.EnemyPlayerHeroTeam[i] = new Hero(); field.EnemyPlayerHeroTeam[i].HeroType = playerHero.MyHeros.Heros[heroId].HeroType; field.EnemyPlayerHeroTeam[i].HeroLv = playerHero.MyHeros.Heros[heroId].HeroLv; field.EnemyPlayerHeroTeam[i].HeroStarLevel = playerHero.MyHeros.Heros[heroId].HeroStarLevel; field.EnemyPlayerHeroTeam[i].ElevationLevel = playerHero.MyHeros.Heros[heroId].ElevationLevel; field.EnemyPlayerHeroTeam[i].ConsciousnessLevel = playerHero.MyHeros.Heros[heroId].ConsciousnessLevel; field.EnemyPlayerHeroTeam[i].Gears = new CacheDictionary <GearType, int>(); field.EnemyPlayerHeroTeam[i].SkillLevels.AddRange(playerHero.MyHeros.Heros[heroId].SkillLevels); foreach (var gear in playerHero.MyHeros.Heros[heroId].Gears) { field.EnemyPlayerHeroTeam[i].Gears[gear.Key] = gear.Value; } field.EnemyPlayerHeroTeam[i].Souls = new CacheDictionary <int, int>(); foreach (var soul in playerHero.MyHeros.Heros[heroId].Souls) { field.EnemyPlayerHeroTeam[i].Souls[soul.Key] = soul.Value; } //field.EnemyHeroHP.Add(MaxHP); i++; } return(field); }
public static RewardChessField GetRewardChessField(int userId, ChessFieldColor color, Random r) { RewardChessField field = new RewardChessField(); field.Color = color; field.IsOpened = false; field.IsFree = false; field.ParentId = -1; field.RewardCoin = 0; field.RewardMoney = 0; if (color != ChessFieldColor.Empty) { PlayerLogic p = new PlayerLogic(); p.SetUser(userId); double baseRewardCoin = GetBaseRewardCoin(p.MyPlayer.Level); field.RewardCoin = r.Next((int)Math.Round(baseRewardCoin * 0.5), (int)Math.Round(baseRewardCoin * 1.5)); } if (color == ChessFieldColor.RewardGray) { RandomDropLogic rd = RandomDropLogic.GetInstance(); var dropDict = new CacheDictionary <int, int>(); if (r.Next(100) < GameConsts.PlayerChess.TopRewardRate) { var dropData = CacheSet.DropTable.GetData(GameConsts.PlayerChess.TopRewardDropId); rd.GetDropDict(dropData, dropDict); } else { var dropData = CacheSet.DropTable.GetData(GameConsts.PlayerChess.MidRewardDropId); rd.GetDropDict(dropData, dropDict); } if (dropDict.ContainsKey((int)GiftItemType.Money)) { field.RewardMoney += dropDict[(int)GiftItemType.Money]; dropDict.Remove((int)GiftItemType.Money); } foreach (var kv in dropDict) { field.RewardItems.Add(kv); } } return(field); }