Example #1
0
 /// <summary>
 /// 人物死亡
 /// </summary>
 /// <param name="murderer"></param>
 public void Dead(AbstractPlayer murderer)
 {
     //// 全局列表中删除
     //ModuleManagement.getInstance().getPlayerList().remove(player);
     // 设置死亡状态
     player.GetState().SetDead(true);
     player.GetState().SetCurHP(0);
     // 删除手牌
     foreach (AbstractCard c in player.GetState().GetCardList())
     {
         c.Gc();
     }
     player.GetState().GetCardList().Clear();
     // 上下家重置
     player.GetFunction().GetLastPlayer().SetNextPlayer(
         player.GetNextPlayer());
     //检测该人物死亡是否终止游戏
     if (player.GetState().GetId() == EIdentity.ZHUGONG)
     {
         if (GetFanZei() > 0)
         {
             //Frame_Main.me.gameOver(GameOver.FANZEI_WIN);
         }
         else
         {
             //Frame_Main.me.gameOver(GameOver.NEIJIAN_WIN);
         }
         return;
     }
     if (player.GetState().GetId() == EIdentity.FANZEI || player.GetState().GetId() == EIdentity.NEIJIAN)
     {
         int alive = GetFanZeiOrNeiJian();
         Console.WriteLine("反贼或内奸还剩:" + alive + "个");
         if (alive == 0)
         {
             //Frame_Main.me.gameOver(GameOver.ZHUGONG_WIN);
             return;
         }
     }
     // 死亡触发事件
     player.GetTrigger().AfterDead();
     //死亡后的奖惩
     if (murderer != null)
     {
         // 如果死亡者是反贼 凶手获得3张牌
         if (player.GetState().GetId() == EIdentity.FANZEI)
         {
             for (int i = 0; i < 3; i++)
             {
                 murderer.GetAction().AddOneCardFromList();
             }
         }
         //主公误杀忠臣则掉光所有牌
         if (player.GetState().GetId() == EIdentity.ZHONGCHEN &&
             murderer.GetState().GetId() == EIdentity.ZHUGONG)
         {
             murderer.GetState().GetCardList().Clear();
             murderer.GetState().GetEquipment().RemoveALL();
             //AISpeakService.sayFuckBoss(player);
         }
         player.RefreshView();
         murderer.RefreshView();
     }
     //如果在回合中死亡,直接跳出回合,下家开始
     if (player.GetStageNum() != EStageState.STAGE_END)
     {
         Console.WriteLine("dead" + Thread.CurrentThread.Name);
         player.GetNextPlayer().Process();
     }
 }