Example #1
0
        public Hero(Game game, VectorBase pos, HeroSave save, Pronoun pronoun, string name) : base(game, pos.x, pos.y, Option.HeroHealthStart, new Noun("Hero"), pronoun)
        {
            HeroClass = save.HeroClass.Clone();
            Inventory = save.Inventory.clone();
            Equipment = save.Equipment.clone();
            BackPack  = save.BackPack.clone();
            Crucible  = save.Crucible.clone();

            ExperienceCents = save.ExperienceCents;
            Gold            = save.Gold;

            // Hero state is cloned so that if they die in the dungeon, they lose
            // anything they found.
            RefreshLevel(false);

            HeroClass.Bind(this);

            // Give the hero energy so we can act before all of the monsters.
            Energy.CurrentEnergy = Energy.ActionCost;

            // Start with some initial ability to rest so we aren't weakest at the very
            // beginning.
            Food = save.Food;

            Health = save.Health;
            Charge = save.Charge;

            this.Name = name;
        }
Example #2
0
        public override void OnFinishTurn(Action action)
        {
            // Make some noise.
            LastNoise = action.Noise;

            HeroClass.FinishedTurn(action);
        }
Example #3
0
        //public override void OnKilled(Action.Action action, Monster defender)
        public override void OnKilled(Action action, Actor defender)
        {
            var monster = (Monster)defender;

            ExperienceCents += monster.ExperienceCents / Level;
            RefreshLevel(true);
            HeroClass.KilledMonster(action, monster);
        }
Example #4
0
 public HeroSave(
             string name,
             HeroClass heroClass,
             Inventory inventory,
             Equipment equipment,
             //this.home, this.crucible, 
             int experienceCents,
             //this.completedLevels, 
             int gold)
 {
     this.Name = name;
     this.HeroClass = heroClass;
     this.Inventory = inventory;
     this.Equipment = equipment;
     this.ExperienceCents = experienceCents;
     this.Gold = gold;
 }
Example #5
0
        public override Attack OnGetAttack(Actor defender)
        {
            Attack attack = null;

            // See if a melee weapon is equipped.
            var weapon = Equipment.Weapon;

            if (weapon != null && !weapon.isRanged)
            {
                attack = weapon.attack;
            }
            else
            {
                attack = new Attack("punch[es]", Option.HeroPunchDamage);
            }

            // Let the class modify it.
            return(HeroClass.ModifyAttack(attack, defender));
        }
Example #6
0
 public override void OnDamaged(Action action, Actor attacker, int damage)
 {
     HeroClass.TookDamage(action, attacker, damage);
 }
Example #7
0
        ///// The index of the highest [Level] that the [Hero] has completed in each
        ///// [Area]. The key will be the [Area] name. The value will be the one-based
        ///// index of the level. No key means the hero has not completed any levels in
        ///// that area.
        //final Map<String, int> completedLevels;

        public HeroSave(string name, HeroClass heroClass)
        {
            Name = name;
            HeroClass = heroClass;
            //completedLevels = < String, int>{ };
        }