/// <summary>还有挑战次数,返回当前层</summary> /// <param name="count">翻将次数</param> /// <param name="towerpass">当前层基表数据</param> /// <param name="checkpoint">爬塔实体</param> /// <returns></returns> private ASObject GetChalleng(int count, BaseTowerPass towerpass, tg_duplicate_checkpoint checkpoint) { var aso = new ASObject(); var towervo = new TowerPassVo(); if (towerpass.enemyType == (int)DuplicateEnemyType.FIGHTING) { var npcid = Common.GetInstance().GetNpcId(checkpoint); var npclist = Common.GetInstance().GetNpcList(checkpoint); towervo = EntityToVo.ToTowerPassVo(checkpoint, towerpass.enemyType, npcid, count, npclist); if (Common.GetInstance().CheckWatchmenRight(towerpass.watchmen, checkpoint)) { var tower = tg_duplicate_checkpoint.GetEntityByTowerSite(checkpoint.site); var wahtchmen = tg_user.GetUsersById(tower.user_id); if (wahtchmen != null) { var uservo = Common.GetInstance().ConvertUser(wahtchmen); aso = BulidData((int)ResultType.SUCCESS, uservo, towervo, (int)FightResultType.LOSE, checkpoint.blood, checkpoint.dekaron); return(aso); } } } else { towervo = EntityToVo.ToTowerPassVo(checkpoint, towerpass.enemyType, towerpass.enemyId, count, null); } aso = BulidData((int)ResultType.SUCCESS, null, towervo, (int)FightResultType.LOSE, checkpoint.blood, (int)DuplicateRightType.NORIGHT); Common.GetInstance().CheckpointUpdate(checkpoint); return(aso); }
/// <summary>挑战失败,验证挑战次数</summary> public ASObject CheckChallengCount(tg_duplicate_checkpoint checkpoint, BaseTowerPass towerpass, int blood) { var aso = new ASObject(); if (!Variable.OnlinePlayer.ContainsKey(checkpoint.user_id)) { return(aso); } var session = Variable.OnlinePlayer[checkpoint.user_id] as TGGSession; var userextend = session.Player.UserExtend.CloneEntity(); userextend.challenge_count--; userextend.Update(); session.Player.UserExtend = userextend; if (userextend.challenge_count <= 0) { if (Common.GetInstance().CheckWatchmenRight(towerpass.watchmen, checkpoint)) { checkpoint.dekaron = (int)DuplicateRightType.NORIGHT; } else { checkpoint.state = (int)DuplicateClearanceType.CLEARANCE_FAIL; } checkpoint.Update(); aso = BulidData((int)ResultType.SUCCESS, null, null, (int)FightResultType.LOSE, checkpoint.blood, (int)DuplicateRightType.NORIGHT); return(aso); } checkpoint.blood = session.Player.Role.Kind.att_life; return(GetChalleng(userextend.npc_refresh_count, towerpass, checkpoint)); }
/// <summary>验证是否可以挑战改关卡</summary> private bool CheckSiteResult(tg_duplicate_checkpoint checkpoint, BaseTowerPass pass) { if (pass.enemyType != (int)DuplicateEnemyType.FIGHTING) { result = (int)ResultType.TOWER_NPC_NORIGHT; return(false); } if (checkpoint.state == (int)DuplicateClearanceType.CLEARANCE_FAIL || checkpoint.blood <= 0) { result = (int)ResultType.CHALLENGE_FAIL; return(false); } return(true); }
/// <summary>验证挑战守护者的权利</summary> private bool CheckWatchMen(tg_duplicate_checkpoint checkpoint, BaseTowerPass towerpass) { if (towerpass.watchmen != (int)DuplicateTowerType.TOWER)//验证是否达到守护者关卡 { result = (int)ResultType.TOWER_WATCHMEN_NO_OPEN; return(false); } if (checkpoint.dekaron != (int)DuplicateRightType.HAVERIGHT && checkpoint.state != (int)DuplicateClearanceType.CLEARANCE_SUCCESS) //验证是否有权挑战守护者 { result = (int)ResultType.TOWER_WATCHMEN_FIGHT_NORIGHT; return(false); } if (checkpoint.site == checkpoint.tower_site) { result = (int)ResultType.TOWER_NOFIGHT_MYSELF; return(false); } return(true); }