Example #1
0
        protected virtual void OnPhaseChanging(Room room, Player player, ref object data)
        {
            PhaseChangeStruct change = (PhaseChangeStruct)data;

            if (change.To == PlayerPhase.NotActive)
            {
                player.SetFlags(".");
                RoomLogic.ClearPlayerCardLimitation(player, true);
                foreach (Player p in room.GetAllPlayers())
                {
                    if (p.GetMark("drank") > 0)
                    {
                        LogMessage log = new LogMessage
                        {
                            Type = "#UnsetDrankEndOfTurn",
                            From = p.Name
                        };
                        room.SendLog(log);

                        room.SetPlayerMark(p, "drank", 0);
                    }
                }
                if (room.ContainsTag("EdictInvoke") && (bool)room.GetTag("EdictInvoke"))
                {
                    room.SetTag("EdictInvoke", false);
                    LogMessage log = new LogMessage
                    {
                        Type = "#EdictEffect",
                        From = player.Name,
                        Arg  = Edict.ClassName
                    };
                    room.SendLog(log);
                    WrappedCard io = (WrappedCard)room.GetTag("EdictCard");
                    if (io != null)
                    {
                        FunctionCard fcard = Engine.GetFunctionCard(io.Name);
                        foreach (Player p in room.GetAllPlayers())
                        {
                            if (!p.HasShownOneGeneral() && Engine.IsProhibited(room, null, p, io) == null) // from is null!
                            {
                                room.CardEffect(io, null, p);
                            }
                        }
                    }
                }
            }
            else if (change.To == PlayerPhase.Play)
            {
                player.AddHistory(".");
            }
            else if (change.To == PlayerPhase.Start)
            {
                if (!player.General1Showed && Engine.GetGeneral(player.ActualGeneral1, room.Setting.GameMode).IsLord())
                {
                    room.ShowGeneral(player);
                }
            }
        }