public static void AcquireHeroCard(Player player, Hero tag) { Card card = Game.CurrentGame.Decks[DeckType.Heroes][0]; Game.CurrentGame.SyncImmutableCard(player, card); CardsMovement move = new CardsMovement(); move.Cards = new List<Card>() { card }; move.To = new DeckPlace(player, HuaShenDeck); move.Helper.PrivateDeckHeroTag = tag; Game.CurrentGame.MoveCards(move); }
public Player() { isDead = false; id = 0; isMale = false; isFemale = false; maxHealth = 0; health = 0; hero = hero2 = null; attributes = new Dictionary<PlayerAttribute, int>(); equipmentSkills = new List<ISkill>(); additionalSkills = new List<ISkill>(); }
public Player() { isDead = false; id = 0; isMale = false; isFemale = false; maxHealth = 0; health = 0; hero = hero2 = null; attributes = new Dictionary<PlayerAttribute, int>(); equipmentSkills = new List<ISkill>(); additionalSkills = new List<ISkill>(); additionalUndeletableSkills = new List<ISkill>(); AssociatedPlayerAttributes = new Dictionary<PlayerAttribute, PlayerAttribute>(); AssociatedCardAttributes = new Dictionary<CardAttribute, CardAttribute>(); }
public void NotifyImpersonation(Player p, Hero impersonator, Hero impersonatedHero, ISkill acquiredSkill) { }
public void NotifyImpersonation(Player p, Hero impersonator, Hero impersonatedHero, ISkill acquiredSkill) { Application.Current.Dispatcher.Invoke((ThreadStart)delegate() { var view = playersMap[p]; var model = view.PlayerModel.GetHeroModel(impersonator); Trace.Assert(model != null); if (impersonatedHero == null) { model.ImpersonatedHeroName = string.Empty; model.ImpersonatedSkill = string.Empty; } else { model.ImpersonatedHeroName = impersonatedHero.Name; model.ImpersonatedSkill = acquiredSkill.GetType().Name; } view.UpdateImpersonateStatus(model == view.PlayerModel.Hero1Model); }); }
private static string TranslateHeroName(Hero hero) { return Application.Current.TryFindResource(string.Format("Hero.{0}.Name", hero.Name)) as string; }
public static string Translate(Hero hero) { string key = string.Format("Hero.{0}.Name", hero.Name); string name = Application.Current.TryFindResource(key) as string; if (name == null) return string.Empty; return name; }
public ISkill LoseHeroSkill(string skillName, Hero heroTag) { Trace.Assert(heroTag != null && heroTag.Owner == this); ISkill skill = heroTag.LoseSkill(skillName); if (skill != null) { SkillSetChangedEventArgs arg = new SkillSetChangedEventArgs(); arg.Source = this; arg.IsLosingSkill = true; arg.Skills.Add(skill); Game.CurrentGame.Emit(GameEvent.PlayerSkillSetChanged, arg); } return skill; }
public HeroViewModel(Hero hero) : this() { Hero = hero; }
public HeroCardHandler(Hero h) { hero = h; }
public object Clone() { var hero = new Hero(Name, IsMale, Allegiance, MaxHealth, new List<ISkill>()) { HeroConvertFrom = this.HeroConvertFrom }; hero.Skills = new List<ISkill>(); foreach (var s in Skills) { hero.Skills.Add(s.Clone() as ISkill); } return hero; }
public void PlayerAcquireAdditionalSkill(Player p, ISkill skill, Hero tag, bool undeletable = false) { if (p.IsDead) return; p.AcquireAdditionalSkill(skill, tag, undeletable); SkillSetChangedEventArgs args = new SkillSetChangedEventArgs(); args.Source = p; args.Skills.Add(skill); args.IsLosingSkill = false; Emit(GameEvent.PlayerSkillSetChanged, args); _ResetCards(p); }
public bool IsMainHero(Hero h, Player p) { return h == p.Hero; }
public void HandleCardTransfer(Player from, Player to, DeckType target, List<Card> cards, Hero tag = null) { cards = new List<Card>(cards); if (to.IsDead) { if (cards.Any(cd => cd.Place.DeckType != DeckType.Hand && cd.Place.DeckType != DeckType.Equipment && cd.Place.DeckType != DeckType.DelayedTools)) { CardsMovement move1 = new CardsMovement(); move1.Cards = new List<Card>(cards); move1.To = new DeckPlace(null, DeckType.Discard); MoveCards(move1); PlayerLostCard(from, cards); } return; } CardsMovement move = new CardsMovement(); move.Cards = new List<Card>(cards); move.To = new DeckPlace(to, target); move.Helper = new MovementHelper(); move.Helper.PrivateDeckHeroTag = tag; MoveCards(move); bool triggerAcquiredCard = target == DeckType.Hand || target == DeckType.Equipment; EnterAtomicContext(); PlayerLostCard(from, cards); if (triggerAcquiredCard) PlayerAcquiredCard(to, cards); ExitAtomicContext(); }
public void AcquireAdditionalSkill(ISkill skill, Hero tag, bool undeletable = false) { skill.HeroTag = tag; skill.Owner = this; if (undeletable) { additionalUndeletableSkills.Add(skill); } else { additionalSkills.Add(skill); } OnPropertyChanged("Skills"); }
public void LoseAllHeroSkills(Hero h) { Trace.Assert(h.Owner == this); List<ISkill> skills = new List<ISkill>(h.Skills); h.LoseAllSkills(); if (skills.Count > 0) { SkillSetChangedEventArgs arg = new SkillSetChangedEventArgs(); arg.Source = this; arg.IsLosingSkill = true; arg.Skills = skills; Game.CurrentGame.Emit(GameEvent.PlayerSkillSetChanged, arg); } }
internal HeroViewModel GetHeroModel(Hero hero) { if (Hero == hero) return Hero1Model; else if (Hero2 == hero) return Hero2Model; else return null; }
private void SetHero(ref Hero hero, Hero value) { if (hero != null) { PropertyChangedEventHandler handler = PropertyChanged; hero.PropertyChanged -= handler; } hero = value; if (hero != null) { foreach (ISkill skill in hero.Skills) { skill.HeroTag = hero; skill.Owner = this; } Trace.Assert(hero.Owner == null); hero.Owner = this; hero.PropertyChanged += PropertyChanged; } OnPropertyChanged("Skills"); }
public void NotifyImpersonation(Player p, Hero h, ISkill s) { }
public TunTianGetJudgeCardTrigger(Player p, ISkill s, ICard c, Hero tag) : base(p, s, c) { this.tag = tag; }
private void SetHero(ref Hero hero, Hero value) { hero = value; if (hero != null) { foreach (ISkill skill in hero.Skills) { skill.Owner = this; } Trace.Assert(hero.Owner == null); hero.Owner = this; } OnPropertyChanged("Skills"); }