예제 #1
0
 public int this[CardAttribute key]
 {
     get
     {
         if (attributes == null)
         {
             attributes = new Dictionary <CardAttribute, int>();
         }
         if (!attributes.ContainsKey(key))
         {
             return(0);
         }
         else
         {
             return(attributes[key]);
         }
     }
     set
     {
         if (attributes == null)
         {
             attributes = new Dictionary <CardAttribute, int>();
         }
         if (!attributes.ContainsKey(key))
         {
             attributes.Add(key, value);
         }
         else if (attributes[key] == value)
         {
             return;
         }
         attributes[key] = value;
     }
 }
예제 #2
0
 public int this[CardAttribute key]
 {
     get
     {
         if (!attributes.ContainsKey(key))
         {
             return(0);
         }
         else
         {
             return(attributes[key]);
         }
     }
     set
     {
         if (!attributes.ContainsKey(key))
         {
             attributes.Add(key, value);
         }
         else if (attributes[key] == value)
         {
             return;
         }
         attributes[key] = value;
     }
 }
예제 #3
0
 public DummyShaVerifier(Player t, CardHandler shaType, CardAttribute helper = null)
 {
     target = t;
     type = shaType;
     this.helper = helper;
     dummyCards = new List<Card>() { new Card() { Type = shaType, Place = new DeckPlace(null, DeckType.None) } };
 }
예제 #4
0
 public CardAttribute this[object key]
 {
     get
     {
         if (!internalAttributes.ContainsKey(key))
         {
             var attribute = new CardAttribute(this.Name);
             attribute.internalKey = key;
             internalAttributes.Add(key, attribute);
         }
         return internalAttributes[key];
     }
 }
예제 #5
0
 public static CardAttribute Register(string attributeName)
 {
     if (_attributeNames == null)
     {
         _attributeNames = new Dictionary<string, CardAttribute>();
     }
     if (_attributeNames.ContainsKey(attributeName))
     {
         throw new DuplicateAttributeKeyException(attributeName);
     }
     var attr = new CardAttribute(attributeName);
     _attributeNames.Add(attributeName, attr);
     return attr;
 }
예제 #6
0
 public CardAttribute this[Player key]
 {
     get
     {
         if (key == null) return this;
         if (!key.AssociatedCardAttributes.ContainsKey(this))
         {
             var attribute = new CardAttribute(this.Name);
             attribute.internalKey = key;
             key.AssociatedCardAttributes.Add(this, attribute);
         }
         return key.AssociatedCardAttributes[this];
     }
 }
예제 #7
0
 public static CardAttribute Register(string attributeName)
 {
     if (_attributeNames == null)
     {
         _attributeNames = new Dictionary<string, CardAttribute>();
     }
     if (_attributeNames.ContainsKey(attributeName))
     {
         return _attributeNames[attributeName];
     }
     var attr = new CardAttribute(attributeName);
     _attributeNames.Add(attributeName, attr);
     return attr;
 }
예제 #8
0
        public static CardAttribute Register(string attributeName)
        {
            if (_attributeNames == null)
            {
                _attributeNames = new Dictionary <string, CardAttribute>();
            }
            if (_attributeNames.ContainsKey(attributeName))
            {
                throw new DuplicateAttributeKeyException(attributeName);
            }
            var attr = new CardAttribute(attributeName);

            _attributeNames.Add(attributeName, attr);
            return(attr);
        }
예제 #9
0
 /// <summary>
 /// 某玩家对某玩家视为使用一张虚拟的杀,能被技能转化,影响选择的目标,如疠火,朱雀羽扇
 /// </summary>
 public static void UseDummyShaTo(Player source, Player target, CardHandler shaType, Prompt prompt, CardAttribute helper = null, bool notifyShaSound = true)
 {
     CompositeCard sha = new CompositeCard() { Type = shaType };
     var v1 = new DummyShaVerifier(target, shaType, helper);
     ISkill skill;
     List<Card> cards;
     List<Player> players;
     Game.CurrentGame.Emit(GameEvent.PlayerIsAboutToUseCard, new PlayerIsAboutToUseOrPlayCardEventArgs() { Source = source, Verifier = v1 });
     source.AskForCardUsage(prompt, v1, out skill, out cards, out players);
     GameEventArgs args = new GameEventArgs();
     args.Source = source;
     args.Targets = new List<Player>(players);
     if (target != null) args.Targets.Add(target);
     args.Skill = skill == null ? new CardWrapper(source, shaType, notifyShaSound) : skill;
     args.Cards = cards;
     CompositeCard card = null;
     if (skill != null)
     {
         List<Card> dummyCards = new List<Card>() { new Card() { Type = shaType, Place = new DeckPlace(null, DeckType.None) } };
         (skill as CardTransformSkill).TryTransform(dummyCards, null, out card);
         //虚拟的杀是不能有子卡的。
         card.Subcards.Clear();
     }
     //在触发 CommitActionToTargets 的时候,只有在这里,args.Card才会被赋值,且为CompositeCard
     args.Card = card;
     if (args.Targets.Count == 0)
     {
         foreach (Player p in Game.CurrentGame.AlivePlayers)
         {
             if (p != source && v1.FastVerify(source, skill, cards, new List<Player>() { p }) != VerifierResult.Fail)
             {
                 args.Targets.Add(p);
                 break;
             }
         }
     }
     try
     {
         Game.CurrentGame.Emit(GameEvent.CommitActionToTargets, args);
     }
     catch (TriggerResultException)
     {
         //程序总是不应该执行到这里的
         Trace.Assert(false);
     }
 }
예제 #10
0
 public CardAttribute this[Player key]
 {
     get
     {
         if (key == null)
         {
             return(this);
         }
         if (!key.AssociatedCardAttributes.ContainsKey(this))
         {
             var attribute = new CardAttribute(this.Name);
             attribute.internalKey = key;
             key.AssociatedCardAttributes.Add(this, attribute);
         }
         return(key.AssociatedCardAttributes[this]);
     }
 }
예제 #11
0
 public int this[CardAttribute key]
 {
     get
     {
         if (!attributes.ContainsKey(key))
         {
             return 0;
         }
         else
         {
             return attributes[key];
         }
     }
     set
     {
         if (!attributes.ContainsKey(key))
         {
             attributes.Add(key, value);
         }
         else if (attributes[key] == value)
         {
             return;
         }
         attributes[key] = value;
     }
 }
예제 #12
0
파일: Card.cs 프로젝트: pxoylngx/sgs
 public int this[CardAttribute key]
 {
     get
     {
         if (attributes == null)
         {
             attributes = new Dictionary<CardAttribute, int>();
         }
         if (!attributes.ContainsKey(key))
         {
             return 0;
         }
         else
         {
             return attributes[key];
         }
     }
     set
     {
         if (attributes == null)
         {
             attributes = new Dictionary<CardAttribute, int>();
         }
         if (!attributes.ContainsKey(key))
         {
             attributes.Add(key, value);
         }
         else if (attributes[key] == value)
         {
             return;
         }
         attributes[key] = value;
     }
 }