Beispiel #1
0
 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);
 }
Beispiel #2
0
 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>();
 }
Beispiel #3
0
 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);
     });
 }
Beispiel #6
0
 private static string TranslateHeroName(Hero hero)
 {
     return Application.Current.TryFindResource(string.Format("Hero.{0}.Name", hero.Name)) as string;
 }
Beispiel #7
0
 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;
 }
Beispiel #8
0
 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;
 }
Beispiel #9
0
 public HeroViewModel(Hero hero)
     : this()
 {
     Hero = hero;
 }
Beispiel #10
0
 public HeroCardHandler(Hero h)
 {
     hero = h;
 }
Beispiel #11
0
 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;
 }
Beispiel #12
0
 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);
 }
Beispiel #13
0
 public bool IsMainHero(Hero h, Player p)
 {
     return h == p.Hero;
 }
Beispiel #14
0
 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();
 }
Beispiel #15
0
 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");
 }
Beispiel #16
0
 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);
     }
 }
Beispiel #17
0
 internal HeroViewModel GetHeroModel(Hero hero)
 {
     if (Hero == hero) return Hero1Model;
     else if (Hero2 == hero) return Hero2Model;
     else return null;
 }
Beispiel #18
0
 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");
 }
Beispiel #19
0
 public void NotifyImpersonation(Player p, Hero h, ISkill s)
 {
 }
Beispiel #20
0
 public TunTianGetJudgeCardTrigger(Player p, ISkill s, ICard c, Hero tag)
     : base(p, s, c)
 {
     this.tag = tag;
 }
Beispiel #21
0
 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");
 }