public static FightResultView Open(bool isWin, FightType fightType) { FightResultView view = UIMgr.instance.Open <FightResultView>(PREFAB_PATH); view.Show(isWin, fightType); return(view); }
/// <summary>得到战斗vo</summary> private FightVo UserChallenge(Int64 userid, Int64 rivalid, FightType type) { var fight = new Share.Fight.Fight().GeFight(userid, rivalid, type, 0, false, true, true); new Share.Fight.Fight().Dispose(); return(fight.Result != ResultType.SUCCESS ? null : fight.Rfight); }
/// <summary>开始战斗 </summary> public int FightStart(Int64 userid, int baseid, FightType fighttype) { var fight = new Share.Fight.Fight().GeFight(userid, baseid, fighttype, 0, false, true); new Share.Fight.Fight().Dispose(); return(fight.Result != ResultType.SUCCESS ? (int)fight.Result : fight.Iswin ? (int)FightResultType.WIN : (int)FightResultType.LOSE); }
/// <summary>进入战斗</summary> private FightVo NpcChallenge(Int64 userid, Int64 npcid, FightType type) { var fight = new Share.Fight.Fight().GeFight(userid, npcid, type, 0, true); new Share.Fight.Fight().Dispose(); return(fight.Result != ResultType.SUCCESS ? null : fight.Ofight); }
public Fight(FightManager fm, Guid fightId, string creator, FightType type, int teamSize, float timeout, bool sanguinary, bool botsWelcome = true) { CharFightData = new Dictionary <CCharacter, CurrentFightCharData>(); TeamBlue = new Dictionary <int, CCharacter>(); TeamRed = new Dictionary <int, CCharacter>(); TotalTeamHealth = new Dictionary <FightTeam, int>() { { FightTeam.Red, 0 }, { FightTeam.Blue, 0 }, }; Moves = new ConcurrentDictionary <int, FightMove>(); MoveExchanges = new Dictionary <int, Dictionary <int, ExchangeProfile> >(); TeamElos = new Dictionary <FightTeam, double>(); ExchangeCount = 0; _fightId = fightId; Creator = creator; fightState = FightState.QUEUE; Type = type; TeamSize = teamSize; Timeout = timeout; Sanguinary = sanguinary; BotsWelcome = botsWelcome; FightLocation = new Position(LocationType.CITY, LocationType.FIGHT); fightPersistence = new FightInformation(this); _fightManager = fm; }
/// <summary> /// 创建APC的B队 /// </summary> /// <param name="note"></param> /// <returns></returns> public static FightObject[] CreateApcTeam(List<PlayerBusiness> players, FightType fightType, object obj) { Dictionary<int, string> apcPostions = null; switch (fightType) { case FightType.HideAPC: case FightType.SceneAPC: case FightType.RobAPC: case FightType.ProAPC: case FightType.EctypeApc: VisibleApc c = obj as VisibleApc; if (c == null) { return EmptyFightObject; } // 生成战斗怪位置/ID int minCount = (int)(players.Count * c.MinCount); int count = (int)(players.Count * c.MaxCount) + 1; if (count > minCount) { count = NumberRandom.Next(minCount, count); } else { count = minCount; } if (fightType == FightType.HideAPC) { foreach (var player in players) { count += player.GetAddHideApc(); } } count = Math.Min(10, count); apcPostions = c.CreateApc(count); break; case FightType.TaskAPC: case FightType.FamilyBoss: apcPostions = new Dictionary<int, string>(10); Variant task = obj as Variant; if (task != null) { int p; foreach (var v in task) { if (int.TryParse(v.Key.Substring(1), out p)) { apcPostions.Add(p, v.Value.ToString()); } } } break; } if (apcPostions != null && apcPostions.Count > 0) { return CreateApcs(apcPostions); } return EmptyFightObject; }
public override int GetHashCode() { int num = 1; if (FightDefId != 0) { num ^= FightDefId.GetHashCode(); } if (FightMapId != 0) { num ^= FightMapId.GetHashCode(); } if (FightType != 0) { num ^= FightType.GetHashCode(); } if (ConcurrentFightsCount != 0) { num ^= ConcurrentFightsCount.GetHashCode(); } if (OwnFightId != 0) { num ^= OwnFightId.GetHashCode(); } if (OwnTeamIndex != 0) { num ^= OwnTeamIndex.GetHashCode(); } num ^= ((object)teams_).GetHashCode(); if (_unknownFields != null) { num ^= ((object)_unknownFields).GetHashCode(); } return(num); }
public static FightResultBasePanel Create(FightType fightType, FightResultView view) { FightResultBasePanel panel = null; switch (fightType) { case FightType.PVE: //普通副本 panel = new PveFightResultPanel(); break; case FightType.Arena: //竞技场 panel = new PvpFightResultPanel(); break; case FightType.DailyPVE: //每日副本 panel = new DailyDungeonFightResultPanel(); break; case FightType.Expedition: //远征 panel = new ExpeditionFightResultPanel(); break; case FightType.WorldTree: //世界树 panel = new WorldTreeFightResultPanel(); break; case FightType.WorldBoss: //世界Boss break; case FightType.PVP: //PVP panel = new PvpRaceFightResultPanel(); break; case FightType.FirstFight: //第一场战斗 case FightType.SkillDisplay: //技能展示 break; case FightType.ConsortiaFight: //公会战 panel = new PvpFightResultPanel(); break; case FightType.FriendFight: //好友战 panel = new FriendFightResultPanel(); break; case FightType.MineFight: //矿战 panel = new MineFightResultPanel(); break; } if (panel != null) { panel.view = view; } else { Debugger.LogError("[FightResultBasePanel] create panel is null,please check this FightType is implement!!! fightType:" + fightType); } return(panel); }
/// <summary> 获取战斗 </summary> /// <param name="userid">用户Id</param> /// <param name="rivalid">对手Id</param> /// <param name="type">战斗类型</param> /// <param name="hp">要调控血量 (爬塔、活动、连续战斗调用)</param> /// <param name="of">是否获取己方战斗Vo</param> /// <param name="po">是否推送己方战斗</param> /// <param name="or">是否获取对方战斗Vo</param> /// <param name="pr">是否推送对方战斗</param> /// <param name="rolehomeid">(武将宅类型时可用)要挑战武将宅id</param> /// <returns></returns> public Core.Entity.Fight GeFight(Int64 userid, Int64 rivalid, FightType type, Int64 hp = 0, bool of = false, bool po = false, bool or = false, bool pr = false, int rolehomeid = 0) { var handler = new AddHandler(new FightCommon().GeFight); var result = handler.BeginInvoke(userid, rivalid, type, hp, of, po, or, pr, rolehomeid, null, null); var handler1 = (AddHandler)((AsyncResult)result).AsyncDelegate; return(handler1.EndInvoke(result)); }
public void Init(FightType fightType, FightDefinition fightDefinition) { CreateMessageRibbonRoot(); if (fightType == FightType.TeamVersus) { CreateTeamPointCounter(); } }
public static void NowFight(FightType type, int noOfFights = 100000) { // Feel free to try out a different pair of Players... Player playerA = new Player("Adolf", 100, 30); Player playerB = new Player("Josef", 120, 25); IFight1v1Manager fightManager = Fight1v1ManagerFactory.Create(type, playerA, playerB, noOfFights); fightManager.Fight(); }
public override void PopulateFromJson(JObject jsonObject) { this.PopulateFromJson(jsonObject); m_maxSpellInHand = Serialization.JsonTokenValue <int>(jsonObject, "maxSpellInHand", 7); m_fightType = (FightType)Serialization.JsonTokenValue <int>(jsonObject, "fightType", 0); m_playersPerTeam = Serialization.JsonTokenValue <int>(jsonObject, "playersPerTeam", 0); m_fightsCount = Serialization.JsonTokenValue <int>(jsonObject, "fightsCount", 0); m_versusAI = Serialization.JsonTokenValue <bool>(jsonObject, "versusAI", false); m_additionalData = IFightAdditionalDataDefinitionUtils.FromJsonProperty(jsonObject, "additionalData"); }
public static void Initialize(FightType type, FightDefinition definition, FightStatus[] fightStatusArray) { fightType = type; fightDefinition = definition; fights = fightStatusArray; hasEnded = false; localPlayerTeamIndex = -1; allyTeamPoints = 0; opponentTeamPoints = 0; }
/// <summary>得到战斗结果</summary> private int NpcChallenge(Int64 userid, Int64 rivalid, FightType type) { var fight = new Share.Fight.Fight().GeFight(userid, rivalid, type, 0, false, true); new Share.Fight.Fight().Dispose(); if (fight.Result != ResultType.SUCCESS) { return(Convert.ToInt32(fight.Result)); } return(fight.Iswin ? (int)FightResultType.WIN : (int)FightResultType.LOSE); }
public static FightNumber Create(SceneView _scene, SceneEntity _targetHero, FightType _fightType, int _damage) { FightNumber fightNumberGo = MonoGameObjectPool <FightNumber> .Instance.GetUIGameObject(); fightNumberGo.scene = _scene; fightNumberGo.targetHero = _targetHero; fightNumberGo.fightType = _fightType; fightNumberGo.damage = _damage; log.Debug("创建战斗对象"); return(fightNumberGo); }
public Fight(Characters.Character player1, Characters.Character player2, FightType type, Map map) { _fighters = new List<Fighter>(); //_players = new List<Characters.Character>(); //_players.Add(player1); //_players.Add(player2); _ID = map.NextFightID(); _type = type; _state = FightState.Starting; }
/// <summary> 进入战斗 </summary> /// <param name="userid"></param> /// <param name="npcid">rivalid 包括npc</param> /// <param name="rolelife"></param> private int NpcChallenge(Int64 userid, int npcid, FightType type, ref Int64 rolelife) { var fight = new Share.Fight.Fight().GeFight(userid, npcid, type, rolelife, false, true); new Share.Fight.Fight().Dispose(); if (fight.Result != ResultType.SUCCESS) { return(Convert.ToInt32(fight.Result)); } rolelife = fight.PlayHp; return(fight.Iswin ? (int)FightResultType.WIN : (int)FightResultType.LOSE); }
private void setTimedState() { buttons[1].transform.GetChild(1).GetComponentInChildren <Text>().text = "TIMED FIGHT"; buttons[2].transform.GetChild(0).GetComponent <Text>().text = "TIME"; buttons[2].transform.GetChild(1).GetComponentInChildren <Text>().text = time.ToString() + " min."; fightType = "TimedFight"; type = FightType.TimedFight; //foreach (MenuPlayerController mpc in MenuManager.instance.players) //{ // if (mpc.joined) mpc.hasSelectedColor = false; //} }
private void setTeamState() { buttons[1].transform.GetChild(1).GetComponentInChildren <Text>().text = "TEAM FIGHT"; buttons[2].transform.GetChild(0).GetComponent <Text>().text = "LIFES"; buttons[2].transform.GetChild(1).GetComponentInChildren <Text>().text = lifes.ToString(); fightType = "TeamFight"; type = FightType.TeamFight; //foreach(MenuPlayerController mpc in MenuManager.instance.players) //{ // if(mpc.joined) mpc.hasSelectedColor = true; //} }
/// <summary> 获取战斗实体 </summary> /// <param name="userid">当前玩家id</param> /// <param name="rivalid">对手id</param> /// <param name="type">战斗类型</param> /// <param name="hp">要调控血量 (爬塔、活动、连续战斗调用)</param> /// <param name="of">是否获取己方战斗Vo</param> /// <param name="po">是否推送己方战斗</param> /// <param name="or">是否获取对方战斗Vo</param> /// <param name="pr">是否推送对方战斗</param> /// <param name="rolehomeid">(武将宅类型时可用)要挑战武将宅id</param> /// <returns></returns> private Core.Entity.Fight GeFight1(Int64 userid, Int64 rivalid, FightType type, Int64 hp = 0, bool of = false, bool po = false, bool or = false, bool pr = false, int rolehomeid = 0) { var fight = new Core.Entity.Fight(); if (!Variable.OnlinePlayer.ContainsKey(userid)) { fight.Result = ResultType.BASE_PLAYER_OFFLINE_ERROR; return(fight); } var session = Variable.OnlinePlayer[userid] as TGGSession; var roleid = session.Player.Role.Kind.id; RoleHomeId = rolehomeid; fight.Result = GetResult(session, rivalid, Convert.ToInt32(type), hp); if (fight.Result != ResultType.SUCCESS) { return(fight); } fight.PlayHp = GetPlayHp(roleid); fight.Hurt = GetBossHurt(userid); fight.BoosHp = GetBossHp(userid); fight.ShotCount = vo.moves.Sum(m => m.Count()); UpdateWin(fight.PlayHp, roleid); fight.Iswin = vo.isWin; if (of) { fight.Ofight = vo; } if (po) { SendProtocol(session, new ASObject(BuildData(Convert.ToInt32(fight.Result), vo))); } if (or) { fight.Rfight = GetRivalFightVo(); fight.Rfight.wuJiangName = session.Player.User.player_name; } if (!pr) { return(fight); } if (type != FightType.BOTH_SIDES || type != FightType.ONE_SIDE) { return(fight); } var s = Variable.OnlinePlayer[rivalid] as TGGSession; SendProtocol(s, new ASObject(BuildData(Convert.ToInt32(fight.Result), GetRivalFightVo()))); return(fight); }
public static IFight1v1Manager Create(FightType type, Player playerA, Player playerB, int noOfFights) { switch (type) { case FightType.Fair: return(new Fight1v1ManagerFair(playerA, playerB, noOfFights)); case FightType.BiasedA: return(new Fight1v1ManagerBiasedA(playerA, playerB, noOfFights)); default: throw new ArgumentException($"No class corresponding to fight type {type} is available."); } }
public Fight(FightType type, Map map) { myID = map.NextFightID(); myType = type; myState = FightState.STARTING; myMap = map; myTimer = new Timer(new TimerCallback(TimerLoop), null, 1000, 1000); Dictionary <int, int[]> places = GeneratePlaces(); myTeam1 = new FightTeam(0, places[0]); myTeam2 = new FightTeam(1, places[1]); }
public Fight(FightType type, Map map) { myID = map.NextFightID(); myType = type; myState = FightState.STARTING; myMap = map; myTimer = new Timer(new TimerCallback(TimerLoop), null, 1000, 1000); Dictionary<int, int[]> places = GeneratePlaces(); myTeam1 = new FightTeam(0, places[0]); myTeam2 = new FightTeam(1, places[1]); }
public Fight AddFight(int teamSize, FightType fightType = FightType.SINGLE) { var newFightId = Guid.NewGuid(); var newFight = new Fight(this, newFightId, "Mock", fightType, teamSize, 15, true); var success = Fights.TryAdd(newFight.FightId, newFight); if (success) { return(Fights[newFightId]); } else { return(null); } }
public void Show(bool isWin, FightType type) { Debugger.Log(string.Format("iswin:{0},fightType:{1}", isWin, type)); _isWin = isWin; _fightType = type; winRoot.SetActive(_isWin); lostRoot.SetActive(!_isWin); if (_isWin) { Prefab_HeroLevelUpView.SetActive(false); treasureBox.gameObject.SetActive(false); btn_root.SetActive(false); panelDrop.SetActive(false); int star = starNum; float heroDelay = (star + 1) * 0.3f; FightResultProxy.instance.CalcDropItem(type); _dropHeroAndEquipList = FightResultProxy.instance.DropHeroAndEquipList; ShowStars(star); ShowHeroLevelUp(heroDelay); ShowTotalExp(heroDelay); text_pass_time.text = TimeUtil.FormatSecondToMinute(FightController.instance.fightCostTime); text_max_hit.text = FightController.instance.comboCount.ToString(); text_profession_name.text = Localization.Get(GameProxy.instance.AccountName); text_profession_level.text = string.Format(Localization.Get("common.role_icon.role_lv"), GameProxy.instance.AccountLevel); AudioController.instance.PlayAudioRepeat(AudioController.fireworks_audio); } else { goFailedTimeOut.SetActive(FightProxy.instance.fightOverType == FightOverType.Timeout); } //extra hide for (int i = 0, count = tranExtraRoot.Length; i < count; i++) { int childCount = tranExtraRoot[i].childCount; for (int j = 0; j < childCount; j++) { tranExtraRoot[i].GetChild(j).gameObject.SetActive(false); } } resultBasePanel = FightResultBasePanel.Create(type, this); if (resultBasePanel != null) { resultBasePanel.Init(); //Invoke("AutoGoMainView",30); } }
static int set_fightType(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); FightParameter obj = (FightParameter)o; FightType arg0 = (FightType)ToLua.CheckObject(L, 2, typeof(FightType)); obj.fightType = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index fightType on a nil value" : e.Message)); } }
static int get_fightType(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); FightParameter obj = (FightParameter)o; FightType ret = obj.fightType; ToLua.Push(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index fightType on a nil value" : e.Message)); } }
private void storeInDB() { const string METHODNAME = "storeInDB"; try { using (var session = NHibernateHelper.OpenSession()) { using (var transaction = session.BeginTransaction()) { var fightEntry = session.QueryOver <FightHistory>().Where(x => x.FightId == FightId).SingleOrDefault(); if (fightEntry != null) { throw new SqlParseException("fight id already exists"); } FightHistory newFightEntry = new FightHistory() { QueueCreatedTime = QueueCreatedTime.UpToSeconds(), FightStartedTime = FightStartedTime.UpToSeconds(), FightEndedTime = FightEndedTime.UpToSeconds(), FightId = FightId, FightType = FightType.ToString(), TeamSize = TeamSize, Location = Location, FightDuration = FightDuration.ToString("g"), MovesExchanged = MovesExchanged, TeamRedNames = TeamRedNames, TeamBlueNames = TeamBlueNames, LowestDamagePlayer = LowestDamagePlayer, HighestDamagePlayer = HighestDamagePlayer, Winner = Winner }; session.Save(newFightEntry); transaction.Commit(); } } } catch (Exception e) { DebugUtils.Logp(DebugUtils.Level.WARNING, CLASSNAME, METHODNAME, "saving fight to history failed with: " + e.Message); } }
internal Character(string name, int id, CharacterProperties properties, List <Ability> abilities) { ID = id; Name = name; IsOnMap = false; TookActionInPhaseBefore = true; HasUsedBasicAttackInPhaseBefore = false; HasUsedBasicMoveInPhaseBefore = false; HasUsedNormalAbilityInPhaseBefore = false; HasUsedUltimatumAbilityInPhaseBefore = false; CanAttackAllies = false; BasicAttack = DefaultBasicAttack; BasicMove = DefaultBasicMove; GetBasicAttackCells = DefaultGetBasicAttackCells; GetBasicMoveCells = DefaultGetBasicMoveCells; AttackPoints = properties.AttackPoints; HealthPoints = properties.HealthPoints; BasicAttackRange = properties.BasicAttackRange; Speed = properties.Speed; PhysicalDefense = properties.PhysicalDefense; MagicalDefense = properties.MagicalDefense; Shield = properties.Shield; Type = properties.Type; Description = properties.Description; Quote = properties.Quote; Author = properties.Author; // Abilities = new AbilityFactory(this).CreateAndInitiateAbilitiesFromDatabase(); Abilities = abilities; AddTriggersToEvents(); Active.Turn.TurnFinished += character => { if (character != this) { return; } HasFreeAttackUntilEndOfTheTurn = false; HasFreeMoveUntilEndOfTheTurn = false; HasFreeUltimatumAbilityUseUntilEndOfTheTurn = false; }; }
/// <summary> 获取战斗实体 </summary> /// <param name="session">当前玩家session</param> /// <param name="rivalid">对手id</param> /// <param name="type">战斗类型</param> /// <param name="hp">要调控血量 (爬塔有效活动,连续战斗任务有效)</param> /// <param name="of">是否获取己方战斗Vo</param> /// <param name="po">是否推送己方战斗</param> /// <param name="or">是否获取对方战斗Vo</param> /// <param name="pr">是否推送对方战斗</param> /// <param name="rolehomeid">(武将宅类型时可用)要挑战武将宅id</param> /// <returns></returns> public Core.Entity.Fight GeFight(TGGSession session, Int64 rivalid, FightType type, Int64 hp = 0, bool of = false, bool po = false, bool or = false, bool pr = false, int rolehomeid = 0) { var roleid = session.Player.Role.Kind.id; var userid = session.Player.User.id; RoleHomeId = rolehomeid; var fight = new Core.Entity.Fight(); fight.Result = GetResult(session, rivalid, Convert.ToInt32(type), hp); if (fight.Result != ResultType.SUCCESS) { return(fight); } fight.Iswin = vo.isWin; fight.PlayHp = GetPlayHp(roleid); fight.Hurt = GetBossHurt(userid); fight.BoosHp = GetBossHp(userid); if (of) { fight.Ofight = vo; } if (po) { SendProtocol(session, new ASObject(BuildData(Convert.ToInt32(fight.Result), vo))); } if (or) { fight.Rfight = GetRivalFightVo(); } if (!pr) { return(fight); } if (type != FightType.BOTH_SIDES || type != FightType.ONE_SIDE) { return(fight); } var s = Variable.OnlinePlayer[rivalid] as TGGSession; SendProtocol(s, new ASObject(BuildData(Convert.ToInt32(fight.Result), GetRivalFightVo()))); return(fight); }
private void TryDrawLowLifeMessage(int lifeAfterValue, PlayerStatus ownerStatus) { FightType fightType = GameStatus.fightType; if ((fightType != FightType.BossFight && fightType != FightType.TeamVersus) || lifeAfterValue <= 0) { return; } int num = (int)((float)ownerStatus.heroStatus.baseLife * 0.35f); if (lifeAfterValue <= num && (!lifeBefore.HasValue || lifeBefore.Value > num)) { MessageInfoRibbonGroup messageGroup = (GameStatus.localPlayerTeamIndex != ownerStatus.teamIndex) ? MessageInfoRibbonGroup.OtherID : MessageInfoRibbonGroup.MyID; FightUIRework instance = FightUIRework.instance; if (null != instance) { FightInfoMessage message = FightInfoMessage.HeroLowLife(messageGroup); instance.DrawInfoMessage(message, ownerStatus.nickname); } } }
public Character(string name) { #region Property definitions //Define basic properties IsOnMap = false; TookActionInPhaseBefore = true; HasUsedBasicAttackInPhaseBefore = false; HasUsedBasicMoveInPhaseBefore = false; HasUsedNormalAbilityInPhaseBefore = false; HasUsedUltimatumAbilityInPhaseBefore = false; CanAttackAllies = false; Effects = new List <Effect>(); BasicAttack = DefaultBasicAttack; BasicMove = DefaultBasicMove; GetBasicAttackCells = DefaultGetBasicAttackCells; GetBasicMoveCells = DefaultGetBasicMoveCells; //Define database properties SqliteRow characterData = GameData.Conn.GetCharacterData(name); Name = name; AttackPoints = new Stat(this, StatType.AttackPoints, int.Parse(characterData.GetValue("AttackPoints"))); HealthPoints = new Stat(this, StatType.HealthPoints, int.Parse(characterData.GetValue("HealthPoints"))); BasicAttackRange = new Stat(this, StatType.BasicAttackRange, int.Parse(characterData.GetValue("BasicAttackRange"))); Speed = new Stat(this, StatType.Speed, int.Parse(characterData.GetValue("Speed"))); PhysicalDefense = new Stat(this, StatType.PhysicalDefense, int.Parse(characterData.GetValue("PhysicalDefense"))); MagicalDefense = new Stat(this, StatType.MagicalDefense, int.Parse(characterData.GetValue("MagicalDefense"))); Type = characterData.GetValue("FightType").ToFightType(); Description = characterData.GetValue("Description"); Quote = characterData.GetValue("Quote"); Author = characterData.GetValue("Author.Name"); #endregion AddTriggersToEvents(); CreateAndInitiateAbilities(name); }
public void CalcDropItem(FightType type = FightType.PVE) { if (type == FightType.DailyPVE) { _dropHeroAndEquipList = ActivityProxy.instance.fixedRewardGameResDataList; return; } if (FightProxy.instance.CurrentDungeonData != null && FightProxy.instance.CurrentDungeonData.dungeonType == DungeonType.WorldTree) { _dropHeroAndEquipList = FightProxy.instance.dropItems; } else { _dropHeroAndEquipList.Clear(); dropBaseResDictionary.Clear(); List <DropItem> dropItemList = FightProxy.instance.dropItems; if (dropItemList == null) { return; } DropItem item; int count = dropItemList.Count; for (int i = 0; i < count; i++) { item = dropItemList[i]; if (item.itemType == (int)BaseResType.Hero || item.itemType == (int)BaseResType.Equipment || item.itemType == (int)BaseResType.Item) { _dropHeroAndEquipList.Add(item); } else { dropBaseResDictionary[(BaseResType)item.itemType] = dropBaseResDictionary.GetValue((BaseResType)item.itemType) + item.itemNum; } } } }
/// <summary> /// 得到战斗受害值 /// </summary> /// <param name="fb">1为普通,2暴击,3闪避</param> /// <returns></returns> protected int FightValue(FightType fb) { int m = 0; if (m_a <= m_b) { m = NumberRandom.Next(m_a, m_b); } if (m_injuryType == 0) { //物理攻击 Variant GongJi = m_root.Value.GetValueOrDefault<Variant>("GongJi"); Variant FangYu = m_target.Value.GetValueOrDefault<Variant>("FangYu"); if (fb == FightType.PuTong) { m+= GongJi.GetIntOrDefault("V") - FangYu.GetIntOrDefault("V"); } else if (fb == FightType.BaoJi) { m += GongJi.GetIntOrDefault("V") * 2 - FangYu.GetIntOrDefault("V"); } } else { //魔法攻击 Variant MoFaGongJi = m_root.Value.GetValueOrDefault<Variant>("MoFaGongJi"); Variant MoFaFangYu = m_target.Value.GetValueOrDefault<Variant>("MoFaFangYu"); if (fb == FightType.PuTong) { m += MoFaGongJi.GetIntOrDefault("V") - MoFaFangYu.GetIntOrDefault("V"); } else if (fb == FightType.BaoJi) { m += MoFaFangYu.GetIntOrDefault("V") * 2 - MoFaFangYu.GetIntOrDefault("V"); } } return m; }
protected SceneBusiness(SceneBusiness scene) { m_players = new ConcurrentDictionary<string, PlayerBusiness>(); m_walk = scene.m_walk; m_map = scene.m_map; m_id = scene.m_id; m_name = scene.m_name; m_skin = scene.m_skin; m_fightInterval = scene.m_fightInterval; m_fightType = scene.m_fightType; m_intoLimit = scene.m_intoLimit; m_bornX = scene.m_bornX; m_bornY = scene.m_bornY; m_propDest = scene.m_propDest; m_deadDest = scene.m_deadDest; m_showAll = scene.m_showAll; m_fightType = scene.m_fightType; }
public SceneBusiness(GameConfig scene) { m_players = new ConcurrentDictionary<string, PlayerBusiness>(); m_walk = new List<Point>(256); m_map = new Dictionary<Point, int>(256); m_id = scene.ID; m_name = scene.Name; Variant v = (scene.Value == null ? null : scene.Value.GetVariantOrDefault("Config")); if (v != null) { m_fightInterval = v.GetIntOrDefault("TimeLimit"); if (v.GetBooleanOrDefault("canFight")) { m_fightType = FightType.PK; } else { m_fightType = FightType.NotPK; } m_minLev = v.GetIntOrDefault("MinLevel"); m_maxLev = v.GetIntOrDefault("MaxLevel"); IntoLimit limit = new IntoLimit(m_id, m_name, v); if (!limit.IsEmpty) { m_intoLimit = limit; } //初始化降生点道具回城和死亡回城点 Variant bornPoint = v.GetVariantOrDefault("BornPoint"); if (bornPoint != null) { m_bornX = bornPoint.GetIntOrDefault("X"); m_bornY = bornPoint.GetIntOrDefault("Y"); } m_propDest = InitDestination(v.GetVariantOrDefault("BackPoint")); m_deadDest = InitDestination(v.GetVariantOrDefault("DeadPoint")); m_skin = v.GetStringOrDefault("ReUseSceneID"); } }