private static void RunTrackableList() { Console.WriteLine("***** TrackableList (Protobuf) *****"); var list = new TrackableList<string>(); list.SetDefaultTracker(); list.Add("One"); list.Add("Two"); list.Add("Three"); var buf = PrintBytes(Serialize(list.Tracker)); Console.WriteLine(Deserialize<TrackableListTracker<string>>(buf)); list.Tracker.Clear(); list.RemoveAt(0); list[1] = "TwoTwo"; list.Add("Four"); var buf2 = PrintBytes(Serialize(list.Tracker)); Console.WriteLine(Deserialize<TrackableListTracker<string>>(buf2)); list.Tracker.Clear(); Console.WriteLine(); }
private static void RunTrackableList() { Log.WriteLine("***** TrackableList (Json) *****"); var list = new TrackableList<string>(); list.SetDefaultTracker(); list.Add("One"); list.Add("Two"); list.Add("Three"); var json = JsonConvert.SerializeObject(list.Tracker, JsonSerializerSettings); Log.WriteLine(json); list.Tracker.Clear(); list.RemoveAt(0); list[1] = "TwoTwo"; list.Add("Four"); var json2 = JsonConvert.SerializeObject(list.Tracker, JsonSerializerSettings); Log.WriteLine(json2); list.Tracker.Clear(); Log.WriteLine(); }
private static void RunTrackableList() { Log.WriteLine("***** TrackableList (Json) *****"); var list = new TrackableList <string>(); list.SetDefaultTracker(); list.Add("One"); list.Add("Two"); list.Add("Three"); var json = JsonConvert.SerializeObject(list.Tracker, JsonSerializerSettings); Log.WriteLine(json); list.Tracker.Clear(); list.RemoveAt(0); list[1] = "TwoTwo"; list.Add("Four"); var json2 = JsonConvert.SerializeObject(list.Tracker, JsonSerializerSettings); Log.WriteLine(json2); list.Tracker.Clear(); Log.WriteLine(); }
private TrackableList<string> CreateTestList() { var list = new TrackableList<string>(); list.Add("One"); list.Add("Two"); list.Add("Three"); return list; }
private TrackableList <string> CreateTestList() { var list = new TrackableList <string>(); list.Add("One"); list.Add("Two"); list.Add("Three"); return(list); }
private TrackableList<string> CreateTestList(bool withTracker) { var list = new TrackableList<string>(); if (withTracker) list.SetDefaultTracker(); list.Add("One"); list.Add("Two"); list.Add("Three"); return list; }
public void ScheduleExtraTurns(Player player, int count) { for (var i = 0; i < count; i++) { _extraTurns.Add(player); } }
public void AddManaToPool(ManaAmount amount, ManaUsage usage) { lock (_manaPoolCountLock) { foreach (var mana in amount) { for (var i = 0; i < mana.Count; i++) { var unit = new ManaUnit(mana.Color, 0, usageRestriction: usage); Add(unit); _manaPool.Add(unit); } } } }
public void Receive(AbilityActivatedEvent e) { if (e.Ability.OwningCard.Is().Planeswalker) { _planeswalkerActivations.Add(e.Ability.OwningCard); } }
public void Add(Counter counter) { counter.ModifyStrenght(_strenght); _counters.Add(counter); Publish(new CounterAddedEvent(counter, _owningCard)); }
public virtual void Add(Card card) { card.ChangeZone( destination: this, add: c => _cards.Add(c)); CardAdded(this, new ZoneChangedEventArgs(card)); }
public void Receive(AttackerJoinedCombatEvent message) { _attackers.Add(message.Attacker.Card); if (message.Attacker.Controller.IsActive) { _hasActivePlayerAttackedThisTurn.Value = true; } }
private TrackableList<JobData> CreateTestList() { var list = new TrackableList<JobData>(); var value1 = new JobData(); value1.Kind = 101; value1.Count = 1; value1.Note = "Handmade Sword"; list.Add(value1); var value2 = new JobData(); value2.Kind = 102; value2.Count = 3; value2.Note = "Lord of Ring"; list.Add(value2); return list; }
public void Push(Effect effect) { _effects.Add(effect); effect.EffectWasPushedOnStack(); EffectAdded(this, new StackChangedEventArgs(effect)); Publish(new EffectPutOnStackEvent(effect)); LogFile.Debug("Effect pushed on stack: {0}.", effect); }
public void AddModifier(ICardModifier modifier, ModifierParameters p) { _modifiers.Add(modifier); ActivateModifier(modifier, p); if (IsPermanent) { Publish(new PermanentModifiedEvent(this, modifier)); } }
public void DeclareBlocker(Card cardBlocker, Card cardAttacker) { var attacker = FindAttacker(cardAttacker); var blocker = CreateBlocker(cardBlocker, attacker); attacker.AddBlocker(blocker); _blockers.Add(blocker); Publish(new BlockerJoinedCombatEvent(blocker, attacker)); }
public void Remove(ManaUnit unit) { if (_manaPool.Contains(unit)) { _removeList.Add(unit); return; } RemovePermanently(unit); }
private TrackableList <JobData> CreateTestList() { var list = new TrackableList <JobData>(); var value1 = new JobData(); value1.Kind = 101; value1.Count = 1; value1.Note = "Handmade Sword"; list.Add(value1); var value2 = new JobData(); value2.Kind = 102; value2.Count = 3; value2.Note = "Lord of Ring"; list.Add(value2); return(list); }
public void Add(Static ability) { var simpleAbility = new SimpleAbility(ability); simpleAbility.Initialize(ChangeTracker); _all.Add(simpleAbility); if (!_active.Contains(ability)) { _active.Add(ability); } }
public void AddModifier(IPlayerModifier modifier, ModifierParameters p) { p.Owner = this; _modifiers.Add(modifier); modifier.Initialize(p, Game); modifier.Activate(); foreach (var modifiableProperty in ModifiableProperties) { modifiableProperty.Accept(modifier); } }
public void JoinAttack(Card card, bool wasDeclared = false) { var attacker = CreateAttacker(card); _attackers.Add(attacker); if (!card.Has().Vigilance) { card.Tap(); } Publish(new AttackerJoinedCombatEvent(attacker, wasDeclared)); }
private void AddUnits(IManaAmount amount) { foreach (var singleColor in amount) { for (var i = 0; i < singleColor.Count; i++) { var unit = CreateManaUnit(singleColor.Color); _units.Add(unit); _manaCache.Add(unit); } } }
private static void RunTrackableList() { Log.WriteLine("***** TrackableList *****"); var list = new TrackableList<string>(); list.SetDefaultTracker(); list.Add("One"); list.Add("Two"); list.Add("Three"); Log.WriteLine(list.Tracker.ToString()); list.Tracker.Clear(); list.RemoveAt(0); list[1] = "TwoTwo"; list.Add("Four"); Log.WriteLine(list.Tracker.ToString()); list.Tracker.Clear(); Log.WriteLine(); }
public void Add(ManaUnit unit) { foreach (var colorIndex in unit.Color.Indices) { _groups[colorIndex].Add(unit); } // Every mana can be used as colorless. // True colorless mana was already added, so we don't add it again. if (unit.Color.IsColorless == false) { _units.Add(unit); } }
private void AddModifier(Card card) { var modifier = _modifierFactory(); _modifiers.Add(modifier); _doNotUpdate.Value = modifier; var p = new ModifierParameters { SourceCard = Source, }; card.AddModifier(modifier, p); }
private static void RunTrackableList() { Console.WriteLine("***** TrackableList *****"); var list = new TrackableList <string>(); list.SetDefaultTracker(); list.Add("One"); list.Add("Two"); list.Add("Three"); Console.WriteLine(list.Tracker); list.Tracker.Clear(); list.RemoveAt(0); list[1] = "TwoTwo"; list.Add("Four"); Console.WriteLine(list.Tracker); list.Tracker.Clear(); Console.WriteLine(); }
public void Attach(Card attachment) { if (attachment.IsAttached) { var controller = attachment.AttachedTo.Controller; attachment.AttachedTo.Detach(attachment); if (controller != Controller && !Controller.Battlefield.Contains(attachment)) { Controller.PutCardToBattlefield(attachment); } } attachment.AttachedTo = this; _attachments.Add(attachment); Publish(new AttachmentAttachedEvent(attachment)); }
private void PutAuraToBattlefield(Card aura, Player controller) { Enqueue(new SelectCards( controller, p => { p.MinCount = 1; p.MaxCount = 1; p.Text = String.Format("Select a permanent to attach to."); p.SetValidator(aura.CanTarget); p.Zone = Zone.Battlefield; p.OwningCard = aura; p.ProcessDecisionResults = this; p.ChooseDecisionResults = this; p.CanSelectOnlyCardsControlledByDecisionController = false; })); _aurasQueue.Add(aura); }
private void ChooseCardToPutIntoPlay(Player player) { Enqueue(new SelectCards( player, p => { p.MinCount = 1; p.MaxCount = 1; p.Text = "Select a card."; p.SetValidator(_selector); p.Zone = _zone; p.OwningCard = Source.OwningCard; p.ProcessDecisionResults = this; p.ChooseDecisionResults = this; p.AurasNeedTarget = true; } )); _playerQueue.Add(player); }
private void Activate() { // should be set at start or there will be an // infinite loop _isActivated.Value = true; foreach (var modifier in _modifierFactories.Select(factory => factory())) { var p = new ModifierParameters { IsStatic = true, SourceCard = OwningCard }; var lifetime = new ManualLifetime(); modifier.AddLifetime(lifetime); _lifetimes.Add(lifetime); if (modifier is IGameModifier) { Game.AddModifier((IGameModifier)modifier, p); continue; } if (modifier is ICardModifier) { OwningCard.AddModifier((ICardModifier)modifier, p); continue; } if (modifier is IPlayerModifier) { OwningCard.Controller.AddModifier((IPlayerModifier)modifier, p); continue; } } }
public void Enable() { foreach (var modifier in _modifierFactories.Select(factory => factory())) { var p = new ModifierParameters { IsStatic = true, SourceCard = OwningCard }; var lifetime = new ManualLifetime(); modifier.AddLifetime(lifetime); _lifetimes.Add(lifetime); if (modifier is IGameModifier) { Game.AddModifier((IGameModifier)modifier, p); continue; } if (modifier is ICardModifier) { OwningCard.AddModifier((ICardModifier)modifier, p); continue; } if (modifier is IPlayerModifier) { OwningCard.Controller.AddModifier((IPlayerModifier)modifier, p); continue; } } _isEnabled.Value = true; }
public void QueueTriggered(Effect effect) { _triggeredEffects.Add(effect); }
public virtual void AddToEnd(Card card) { Add(card, c => _cards.Add(c)); }
public void AssignDamage(DamageFromSource damage) { _assignedDamage.Add(damage); }
public void AddPrevention(DamagePrevention prevention) { _preventions.Add(prevention); }