Пример #1
0
 public override bool Triggerable(Player target, Room room)
 {
     if (target == null)
     {
         return(false);
     }
     return(RoomLogic.HasArmorEffect(room, target, Name));
 }
Пример #2
0
 public override void OnUninstall(Room room, Player player, WrappedCard card)
 {
     if (player.Alive && RoomLogic.HasArmorEffect(room, player, Name, false))
     {
         player.SetFlags("peacespell_throwing");
     }
     base.OnUninstall(room, player, card);
 }
Пример #3
0
        public override int GetExtra(Room room, Player target)
        {
            if (RoomLogic.HasArmorEffect(room, target, PeaceSpell.ClassName))
            {
                int count = 1;
                foreach (Player p in room.GetOtherPlayers(target))
                {
                    if (RoomLogic.IsFriendWith(room, target, p))
                    {
                        count++;
                    }
                }

                count += target.GetPile("heavenly_army").Count;

                return(count);
            }

            return(0);
        }
Пример #4
0
        public virtual TriggerStruct Cost(Room room, ref object data, TriggerStruct info)
        {
            Player target = room.FindPlayer(info.Invoker, true);

            if (RoomLogic.HasArmorEffect(room, target, Name, false) &&
                (frequency == Frequency.Compulsory || room.AskForSkillInvoke(target, Name, data)))
            {
                return(info);
            }

            List <string> all     = new List <string>();
            bool          show    = false;
            bool          protect = true;

            foreach (ViewHasSkill vhskill in Engine.ViewHas(room, target, Name, "armor"))
            {
                Skill mskill = Engine.GetMainSkill(vhskill.Name);
                if (RoomLogic.PlayerHasShownSkill(room, target, mskill))
                {
                    protect = false;
                    if (frequency == Frequency.Compulsory)
                    {
                        show = true;
                    }
                }
                all.Add(mskill.Name);
            }
            if (protect)
            {
                target.SetFlags("Global_askForSkillCost");
            }

            if (all.Count > 0)
            {
                List <TriggerStruct> skills = new List <TriggerStruct>();
                foreach (string sk in all)
                {
                    TriggerStruct skill = new TriggerStruct(sk, target)
                    {
                        ResultTarget = info.ResultTarget
                    };
                    skills.Add(skill);
                }
                TriggerStruct result = room.AskForSkillTrigger(target, "armorskill", skills, !show, data);

                if (string.IsNullOrEmpty(result.SkillName))
                {
                    return(result);
                }
                else
                {
                    TriggerSkill result_skill = Engine.GetTriggerSkill(result.SkillName);
                    if (result_skill != null)
                    {
                        if (show || all.Count > 1 || room.AskForSkillInvoke(target, result_skill.Name, data, result.SkillPosition))
                        {
                            return(result);
                        }
                    }
                    else if (show || all.Count > 1 || room.AskForSkillInvoke(target, result_skill.Name, data, result.SkillPosition))
                    {
                        return(info);
                    }
                }
            }
            return(new TriggerStruct());
        }