public override void Execute(Hero hero, string action) { if (action.Equals(AcRead)) { if (hero.Buff <Blindness>() != null) { GLog.Warning(TxtBlinded); return; } CurUser = hero; HeroSubClass way1 = null; HeroSubClass way2 = null; switch (hero.heroClass.Ordinal()) { case HeroClassType.Warrior: way1 = HeroSubClass.GLADIATOR; way2 = HeroSubClass.BERSERKER; break; case HeroClassType.Mage: way1 = HeroSubClass.BATTLEMAGE; way2 = HeroSubClass.WARLOCK; break; case HeroClassType.Rogue: way1 = HeroSubClass.FREERUNNER; way2 = HeroSubClass.ASSASSIN; break; case HeroClassType.Huntress: way1 = HeroSubClass.SNIPER; way2 = HeroSubClass.WARDEN; break; default: throw new ArgumentOutOfRangeException(); } GameScene.Show(new WndChooseWay(this, way1, way2)); } else { base.Execute(hero, action); } }
public virtual void Choose(HeroSubClass way) { Detach(CurUser.Belongings.Backpack); CurUser.Spend(TimeToRead); CurUser.Busy(); CurUser.subClass = way; CurUser.Sprite.DoOperate(CurUser.pos); Sample.Instance.Play(Assets.SND_MASTERY); SpellSprite.Show(CurUser, SpellSprite.Mastery); CurUser.Sprite.Emitter().Burst(Speck.Factory(Speck.MASTERY), 12); GLog.Warning("You have chosen the way of the {0}!", Utils.Capitalize(way.Title)); if (way == HeroSubClass.BERSERKER && CurUser.HP <= CurUser.HT * Fury.Level) { Buff.Affect <Fury>(CurUser); } }
public WndChooseWay(TomeOfMastery tome, HeroSubClass way1, HeroSubClass way2) { var titlebar = new IconTitle(); titlebar.Icon(new ItemSprite(tome.Image, null)); titlebar.Label(tome.Name); titlebar.SetRect(0, 0, WIDTH, 0); Add(titlebar); var hl = new Highlighter(way1.Desc + "\\Negative\\Negative" + way2.Desc + "\\Negative\\Negative" + TxtMessage); var normal = PixelScene.CreateMultiline(hl.Text, 6); normal.MaxWidth = WIDTH; normal.Measure(); normal.X = titlebar.Left(); normal.Y = titlebar.Bottom() + Gap; Add(normal); if (hl.IsHighlighted) { normal.Mask = hl.Inverted(); var highlighted = PixelScene.CreateMultiline(hl.Text, 6); highlighted.MaxWidth = normal.MaxWidth; highlighted.Measure(); highlighted.X = normal.X; highlighted.Y = normal.Y; Add(highlighted); highlighted.Mask = hl.Mask; highlighted.Hardlight(TitleColor); } var btnWay1 = new RedButton(Utils.Capitalize(way1.Title)); btnWay1.ClickAction = button => { Hide(); tome.Choose(way1); }; btnWay1.SetRect(0, normal.Y + normal.Height + Gap, (WIDTH - Gap) / 2, BtnHeight); Add(btnWay1); var btnWay2 = new RedButton(Utils.Capitalize(way2.Title)); btnWay2.ClickAction = button => { Hide(); tome.Choose(way2); }; btnWay2.SetRect(btnWay1.Right() + Gap, btnWay1.Top(), btnWay1.Width, BtnHeight); Add(btnWay2); var btnCancel = new RedButton(TxtCancel); btnCancel.ClickAction = button => Hide(); btnCancel.SetRect(0, btnWay2.Bottom() + Gap, WIDTH, BtnHeight); Add(btnCancel); Resize(WIDTH, (int)btnCancel.Bottom()); }