Example #1
0
        public DirectionalGuard(GuardType type, Direction dir)
        {
            switch (type)
            {
            case GuardType.HumanGreen:
                texOffset = 482;
                break;

            case GuardType.HumanBlue:
                texOffset = 434;
                break;

            case GuardType.Witch:
                break;

            case GuardType.Robot:
                break;

            case GuardType.Penelope:
                break;

            case GuardType.DRHammerstein:
                break;
            }
            this.direction = dir;
            Game.player.AddSprite(this);
        }
    // Used when maze is built to receive data about current room
    public void OnMazeUpdate(MazeRoom room)
    {
        // Add a guard
        int       guardIndex = Random.Range(0, guards.Length);
        GuardType newGuard   = guards[guardIndex];
        int       count      = Random.Range(newGuard.minCount, newGuard.maxCount);

        // start from Random(0, maxCount-count)
        Vector3 startPosition = newGuard.minPosition + newGuard.step * Random.Range(0, newGuard.maxCount - count);

        for (int i = 0; i < count; i++)
        {
            Vector3    localPosition = startPosition + newGuard.step * i;
            GameObject go            = (GameObject)Instantiate(newGuard.prefab, Vector3.zero, Quaternion.identity);
            go.transform.parent        = room.roomObject.transform;
            go.transform.localPosition = localPosition;
            // Update patrol points from start position (take 0 as reference point)
            Guard g = go.GetComponent <Guard>();
            for (int p = 0; p < g.patrol.Length; p++)
            {
                // substract position to patrol waypoint
                g.patrol[p].position -= localPosition;
                // modify speed a little
                float speedFactor = Random.Range(0.8f, 1.6f);
                g.patrol[p].speedToReach *= speedFactor;
                // adap sprite animation fps to speed (we know that's the animation at index 1, ugly hard coded thing...)
                g.spriteAnimation.animationList[1].fps *= speedFactor;
            }
        }
    }
Example #3
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            m_Type = (GuardType)reader.ReadInt();
        }
Example #4
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="activityMemento"></param>
 protected Activity(ActivityMemento activityMemento)
 {
     Id          = activityMemento.Id;
     Name        = activityMemento.Name;
     Description = activityMemento.Description;
     IsEnabled   = activityMemento.IsEnabled;
     Workflow    = activityMemento.Workflow;
     Settings    = activityMemento.Settings;
     Guard       = activityMemento.Guard;
 }
Example #5
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            //Maka
            m_GuardTheme = (CraftResource)reader.ReadInt();
            m_GuardType  = (GuardType)reader.ReadInt();
            m_Disappears = reader.ReadBool();
        }
Example #6
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            if (version > 0)
            {
                m_Type      = (GuardType)reader.ReadInt();
                FactionName = reader.ReadString();
            }
        }
Example #7
0
		/// <summary>
		/// Draws the required guard bar
		/// </summary>
		/// <param name="state">drawing state</param>
		/// <param name="type">type of guard bar to draw</param>
		protected void DrawGuardBar(State state, GuardType type)
		{
			Rectangle[] guardbar = DrawPattern(PatternSet[(int)type], state);
			int offset = (5 * state.Settings.NarrowWidth) / 2;
			foreach (Rectangle bar in guardbar)
			{
				bar.Inflate(0, offset);
				bar.Offset(0, offset);

				state.Canvas.FillRectangle(Brushes.Black, bar);
			}

			state.Left += PatternSet[(int)type].NarrowCount * state.Settings.NarrowWidth;
		}
Example #8
0
        private void Chase()
        {
            agent.SetDestination(player.transform.position);

            if (agent.remainingDistance > playerStoppingDistance)
            {
                character.Move(agent.desiredVelocity, false, false);
            }
            else
            {
                character.Move(Vector3.zero, false, false);
                guardType = GuardType.Caught;
            }
        }
Example #9
0
        /// <summary>
        /// Draws the required guard bar
        /// </summary>
        /// <param name="state">drawing state</param>
        /// <param name="type">type of guard bar to draw</param>
        protected void DrawGuardBar(State state, GuardType type)
        {
            Rectangle[] guardbar = DrawPattern(PatternSet[(int)type], state);
            int         offset   = (5 * state.Settings.NarrowWidth) / 2;

            foreach (Rectangle bar in guardbar)
            {
                bar.Inflate(0, offset);
                bar.Offset(0, offset);

                state.Canvas.FillRectangle(Brushes.Black, bar);
            }

            state.Left += PatternSet[(int)type].NarrowCount * state.Settings.NarrowWidth;
        }
Example #10
0
 public Guard(string name, GuardType gtype, ICondition c)
     : base(name, c)
 {
     if (Transitions.Any())
     {
         Type = GuardType.TRANSITION;
     }
     else if (gtype == GuardType.Undefined)
     {
         Type = GuardType.ENTER;
     }
     else
     {
         Type = gtype;
     }
 }
Example #11
0
 public Guard(string name, GuardType gtype, ICondition c)
     : base(name, c)
 {
     if (Transitions.Any())
     {
         Type = GuardType.TRANSITION;
     }
     else if (gtype == GuardType.Undefined)
     {
         Type = GuardType.ENTER;
     }
     else
     {
         Type = gtype;
     }
 }
Example #12
0
        public Guard AddGuard(ICondition c, GuardType gtype = GuardType.ENTER, string name = null)
        {
            if (string.IsNullOrEmpty(name))
            {
                name = "G" + (_guards.Count + 1);
            }
            else if (_guards.ContainsKey(name))
            {
                throw new CompilerException(ErrorCode.GuardNameReused, "guard '" + name + "' already exists.");
            }

            var guard = new Guard(name, gtype, c);

            _guards.Add(name, guard);
            return(guard);
        }
Example #13
0
        public Guard(GuardType type)
        {
            this.type = type;
            PlayAnim(GuardAnimation.idle);
            Game.player.AddSprite(this);

            switch (type)
            {
            case GuardType.Frankenstein:
                attackTime = 2.5f;
                break;

            case GuardType.Bat:
                break;

            case GuardType.Mummy:
                break;

            case GuardType.Skeleton:
                attackRange = 10;
                attackTime  = 5;
                break;

            case GuardType.HumanGreen:
                break;

            case GuardType.HumanBlue:
                break;

            case GuardType.Witch:
                break;

            case GuardType.Gargorle:
                break;

            case GuardType.Robot:
                break;

            case GuardType.Penelope:
                break;

            case GuardType.DRHammerstein:
                break;
            }

            attackTimer = attackTime;
        }
Example #14
0
        void Guard(Rule top)
        {
            string     name = null;
            ICondition cond;
            GuardType  gtype = GuardType.Undefined;

            UpdateLocation();

            Expect(17);
            if (la.kind == 1)
            {
                Identifier(out name);
            }
            while (la.kind == 18)
            {
                Get();
                var when = new Rule(top, false);
                if (la.kind == 19)
                {
                    Get();
                    gtype = GuardType.ENTER;
                }
                else if (la.kind == 20)
                {
                    Get();
                    gtype = GuardType.LEAVE;
                }
                else if (la.kind == 1 || la.kind == 28 || la.kind == 29)
                {
                }
                else
                {
                    SynErr(40);
                }
                Condition(out cond);
                when.NestCondition(cond);
                while (la.kind == 21 || la.kind == 22 || la.kind == 23)
                {
                    Action(when);
                }
                when.CreateGuard(SM, name, gtype);
            }
        }
Example #15
0
        private void Update()
        {
            if (IsPlayerVisible())
            {
                //if (this.guardType != GuardType.Caught)
                this.guardType = GuardType.Chasing;

                StartLoseSequence();
            }

            switch (guardType)
            {
            case GuardType.Idle:
                break;

            case GuardType.Turn:
                if (!isMoving)
                {
                    TurnToNextPoint();
                }
                break;

            case GuardType.Patrol:
                Patrol();
                break;

            case GuardType.Chasing:
                Chase();
                break;
            }


            //pre baked chase-related commands in AI controller.
            //if (target != null)
            //    agent.SetDestination(target.position);

            //if (agent.remainingDistance > agent.stoppingDistance)
            //    character.Move(agent.desiredVelocity, false, false);
            //else
            //    character.Move(Vector3.zero, false, false);
        }
Example #16
0
        private string GetTitle(GuardType type)
        {
            string title;

            switch (type)
            {
            default:
            case GuardType.Archer: title = "the Archer"; break;

            case GuardType.Cavalry: title = "the Dragoon"; break;

            case GuardType.Pikeman: title = "the Hoplite"; break;

            case GuardType.Swordsman: title = "the Knight"; break;

            case GuardType.Wizard: title = "the Wizard"; break;

            case GuardType.Medic: title = "the Medic"; break;
            }

            return(title);
        }
Example #17
0
        private string GetTitle(GuardType type)
        {
            string title;

            switch (type)
            {
            default:
            case GuardType.Archer: title = "the Imperial Archer"; break;

            case GuardType.Cavalry: title = "Imperial Cavalry"; break;

            case GuardType.Pikeman: title = "the Imperial Hoplite"; break;

            case GuardType.Swordsman: title = "the Imperial Knight"; break;

            case GuardType.Wizard: title = "the Imperial Wizard"; break;

            case GuardType.Medic: title = "the Imperial Medic"; break;
            }

            return(title);
        }
Example #18
0
        private string GetTitle(GuardType type)
        {
            string title;

            switch (type)
            {
            default:
            case GuardType.Archer: title = "Arquero vigia"; break;

            case GuardType.Cavalry: title = "Guardia jinete"; break;

            case GuardType.Pikeman: title = "Guardia Landsmen"; break;

            case GuardType.Swordsman: title = "Guardia Hersir"; break;

            case GuardType.Wizard: title = "Guardia Bondi"; break;

            case GuardType.Medic: title = "Guardia curandero"; break;
            }

            return(title);
        }
Example #19
0
        private string GetTitle(GuardType type)
        {
            string title;

            switch (type)
            {
                default:
                case GuardType.Archer: title = "the Imperial Archer"; break;
                case GuardType.Cavalry: title = "Imperial Cavalry"; break;
                case GuardType.Pikeman: title = "the Imperial Hoplite"; break;
                case GuardType.Swordsman: title = "the Imperial Knight"; break;
                case GuardType.Wizard: title = "the Imperial Wizard"; break;
                case GuardType.Medic: title = "the Imperial Medic"; break;
            }

            return title;
        }
Example #20
0
        public Guard(GuardType type, PlayerFaction a)
            : base(AIType.AI_Melee, FightMode.Aggressor, 18, 1, 0.2, 0.4)
        {
            Faction = a;
            Faction.guardCount++;

            m_Type = type;
            Title  = GetTitle(type);

            if (m_Type == GuardType.Wizard)
            {
                ChangeAIType(AIType.AI_Mage);
            }

            if (m_Type == GuardType.Archer)
            {
                ChangeAIType(AIType.AI_Archer);
            }

            if (m_Type == GuardType.Medic)
            {
                ChangeAIType(AIType.AI_Healer);
            }


            Hue   = Utility.RandomSkinHue();
            Karma = 12000;

            if (0.50 >= Utility.RandomDouble())
            {
                Name   = NameList.RandomName("female") + ",";
                Female = true;
                Body   = 0x191;
            }
            else
            {
                Name             = NameList.RandomName("male") + ",";
                Body             = 0x190;
                FacialHairItemID = Utility.RandomList
                                       (0x203E, 0x203F, 0x2040, 0x2041, 0x204B, 0x204C, 0x204D);
            }

            SetStatsAndSkills(type);

            SetDamage(7, 13);
            SetDamageType(ResistanceType.Physical, 100);

            SetResistance(ResistanceType.Physical, 55, 65);
            SetResistance(ResistanceType.Fire, 40, 50);
            SetResistance(ResistanceType.Cold, 30, 45);
            SetResistance(ResistanceType.Poison, 40, 50);
            SetResistance(ResistanceType.Energy, 50, 60);

            HairItemID = Utility.RandomList(0x203B, 0x203C, 0x203D, 0x2048);
            HairHue    = FacialHairHue = Utility.RandomHairHue();

            Backpack pack = new Backpack();

            pack.AddItem(new Bandage(Utility.RandomMinMax(100, 200)));

            this.AddItem(pack);

            AddEquipment(type);

            if (type == GuardType.Cavalry)
            {
                WarHorse horse = new WarHorse();
                horse.Body          = 0xE4;
                horse.Controlled    = true;
                horse.ControlMaster = this;
                horse.ControlOrder  = OrderType.Come;
                horse.RawName       = "a War Horse";
                horse.Hue           = Faction.primaryHue;
                horse.ItemID        = 16033;
                horse.Rider         = this;

                //Veteran Warhorse
                int techBonus = (Utility.RandomMinMax(50, 75) * Faction.MilitaryLevel);
                horse.SetHits(HitsMax + techBonus);

                horse.RawStr += Utility.RandomMinMax(45, 60);
                horse.RawDex += Utility.RandomMinMax(25, 30);
                horse.RawInt += Utility.RandomMinMax(15, 20);

                horse.SetSkill(SkillName.Wrestling, horse.Skills.Wrestling.Value + Utility.RandomMinMax(15, 20));
                horse.SetSkill(SkillName.Tactics, horse.Skills.Tactics.Value + Utility.RandomMinMax(20, 25));
                horse.SetSkill(SkillName.MagicResist, horse.Skills.MagicResist.Value + Utility.RandomMinMax(30, 40));

                horse.Tamable = false;
            }
        }
Example #21
0
        private void AddEquipment(GuardType type)
        {
            AddItem(new Boots(Faction.primaryHue));
            AddItem(new Cloak(Faction.primaryHue));
            AddItem(new BodySash(Faction.primaryHue));

            switch (type)
            {
            default:
            case GuardType.Archer:
            {
                AddItem(new LeatherLegs());
                AddItem(new StuddedChest());
                AddItem(new LeatherGloves());
                AddItem(new LeatherArms());

                Bow bow = new Bow();
                bow.Quality = WeaponQuality.Exceptional;

                AddItem(bow);
                AddToBackpack(new Arrow(200));
            } break;

            case GuardType.Cavalry:
            {
                AddItem(new PlateLegs());
                AddItem(new RingmailChest());
                AddItem(new FancyShirt());
                AddItem(new PlateGorget());
                AddItem(new RingmailGloves());

                BaseWeapon weapon;

                if (Utility.RandomBool())
                {
                    weapon = new Halberd();
                }
                else
                {
                    weapon = new Bardiche();
                }

                weapon.Quality  = WeaponQuality.Exceptional;
                weapon.Resource = CraftResource.Gold;

                weapon.Speed += (Core.AOS ? 5 : -1);

                AddItem(weapon);
            } break;

            case GuardType.Pikeman:
            {
                AddItem(new RingmailLegs());
                AddItem(new RingmailChest());
                AddItem(new RingmailArms());
                AddItem(new RingmailGloves());
                AddItem(new PlateGorget());

                if (Utility.RandomBool())
                {
                    AddItem(new CloseHelm());
                }
                else
                {
                    AddItem(new NorseHelm());
                }

                AddItem(new Pike());
            } break;

            case GuardType.Swordsman:
            {
                AddItem(new ChainLegs());
                AddItem(new ChainChest());
                AddItem(new RingmailArms());
                AddItem(new RingmailGloves());
                AddItem(new PlateGorget());

                switch (Utility.Random(3))
                {
                case 0: AddItem(new CloseHelm()); break;

                case 1: AddItem(new NorseHelm()); break;

                case 2: AddItem(new PlateHelm()); break;
                }

                BaseWeapon weapon;

                switch (Utility.Random(4))
                {
                default:
                case 0: weapon = new Broadsword(); break;

                case 1: weapon = new Longsword(); break;

                case 2: weapon = new Katana(); break;

                case 3: weapon = new Axe(); break;
                }

                weapon.Quality  = WeaponQuality.Exceptional;
                weapon.Resource = CraftResource.Gold;
                weapon.Layer    = Layer.OneHanded;

                AddItem(weapon);

                if (Utility.RandomBool())
                {
                    AddItem(new HeaterShield());
                }
                else
                {
                    AddItem(new MetalKiteShield());
                }
            }
            break;

            case GuardType.Wizard:
            {
                AddItem(new WizardsHat(Faction.primaryHue));
                AddItem(new Robe(Faction.primaryHue));

                GnarledStaff staff = new GnarledStaff();
                staff.Attributes.SpellDamage = Utility.RandomMinMax(4, 8);

                AddItem(staff);
            }
            break;

            case GuardType.Medic:
            {
                AddItem(new Bandana(Faction.primaryHue));
                AddItem(new Robe(Faction.primaryHue));
            }
            break;
            }
        }
Example #22
0
        private void SetStatsAndSkills(GuardType type)
        {
            switch (type)
            {
            default:
            case GuardType.Cavalry:
            case GuardType.Pikeman:
            case GuardType.Swordsman:
            {
                SetStr(150, 175);
                SetDex(80, 100);
                SetInt(65, 80);

                int techBonus = (Utility.RandomMinMax(50, 75) * Faction.MilitaryLevel);

                SetHits(175 + techBonus, 100 + techBonus);

                SetSkill(SkillName.Tactics, 85, 100);
                SetSkill(SkillName.Healing, 65, 85);
                SetSkill(SkillName.Anatomy, 100, 110);
                SetSkill(SkillName.Wrestling, 95, 110);
                SetSkill(SkillName.Swords, 95, 105);
                SetSkill(SkillName.Fencing, 95, 105);
                SetSkill(SkillName.MagicResist, 95, 105);
            } break;

            case GuardType.Archer:
            {
                SetStr(100, 130);
                SetDex(125, 140);
                SetInt(75, 90);

                int techBonus = (Utility.RandomMinMax(50, 75) * Faction.MilitaryLevel);

                SetHits(90 + techBonus, 100 + techBonus);

                SetSkill(SkillName.Tactics, 85, 100);
                SetSkill(SkillName.Healing, 65, 85);
                SetSkill(SkillName.Anatomy, 100, 105);
                SetSkill(SkillName.Wrestling, 75, 80);
                SetSkill(SkillName.Archery, 95, 105);
                SetSkill(SkillName.MagicResist, 95, 105);

                this.RangeFight = 6;
            } break;

            case GuardType.Wizard:
            {
                SetStr(75, 80);
                SetDex(100, 125);
                SetInt(175, 200);

                int techBonus = (Utility.RandomMinMax(50, 75) * Faction.MilitaryLevel);

                SetHits(90 + techBonus, 100 + techBonus);
                SetMana(100 + techBonus, 200 + techBonus);

                SetSkill(SkillName.Tactics, 70, 85);
                SetSkill(SkillName.Wrestling, 70, 85);
                SetSkill(SkillName.Magery, 100, 130);
                SetSkill(SkillName.EvalInt, 95, 105);
                SetSkill(SkillName.Focus, 60, 70);
                SetSkill(SkillName.Macing, 90, 100);
                SetSkill(SkillName.MagicResist, 95, 105);
                SetSkill(SkillName.Meditation, 90, 100);
            } break;

            case GuardType.Medic:
            {
                SetStr(75, 80);
                SetDex(100, 125);
                SetInt(175, 200);

                int techBonus = (Utility.RandomMinMax(50, 75) * Faction.MilitaryLevel);

                SetHits(90 + techBonus, 100 + techBonus);
                SetMana(100 + techBonus, 200 + techBonus);

                SetSkill(SkillName.Tactics, 40, 55);
                SetSkill(SkillName.Wrestling, 90, 105);
                SetSkill(SkillName.Magery, 100, 105);
                SetSkill(SkillName.EvalInt, 55, 65);
                SetSkill(SkillName.Focus, 60, 70);
                SetSkill(SkillName.Meditation, 90, 100);
                SetSkill(SkillName.MagicResist, 95, 105);
            } break;
            }
        }
Example #23
0
 public GuardException(GuardType type, string message) : base(message + " | | " + type.ToString())
 {
 }
Example #24
0
        public void CreateGuard(StateMachine sm, string name, GuardType type)
        {
            var guard = sm.AddGuard(Condition, type, name);

            guard.AddEffects(Effects);
        }
Example #25
0
 static Guard()
 {
     That = new GuardType();
 }
Example #26
0
        private void AddEquipment(GuardType type)
        {
            AddItem(new Boots());
            AddItem(new Cloak(1155));
            AddItem(new BodySash(1155));

            switch (type)
            {
                default:
                case GuardType.Archer:
                    {
                        AddItem(new LeatherLegs());
                        AddItem(new StuddedChest());
                        AddItem(new LeatherGloves());
                        AddItem(new LeatherArms());

                        Bow bow = new Bow();
                        bow.Quality = WeaponQuality.Exceptional;

                        AddItem(bow);
                        AddToBackpack(new Arrow(200));
                    } break;
                case GuardType.Cavalry:
                    {
                        AddItem(new PlateLegs());
                        AddItem(new RingmailChest());
                        AddItem(new FancyShirt());
                        AddItem(new PlateGorget());
                        AddItem(new RingmailGloves());

                        BaseWeapon weapon;

                        if (Utility.RandomBool())
                            weapon = new Halberd();
                        else
                            weapon = new Bardiche();

                        weapon.Quality = WeaponQuality.Exceptional;
                        weapon.Resource = CraftResource.Gold;
                        weapon.Speed += 5;

                        AddItem(weapon);
                    } break;

                case GuardType.Pikeman:
                    {
                        AddItem(new RingmailLegs());
                        AddItem(new RingmailChest());
                        AddItem(new RingmailArms());
                        AddItem(new RingmailGloves());
                        AddItem(new PlateGorget());

                        if (Utility.RandomBool())
                            AddItem(new CloseHelm());
                        else
                            AddItem(new NorseHelm());

                        AddItem(new Pike());
                    }
                    break;

                case GuardType.Swordsman:
                    {
                        AddItem(new ChainLegs());
                        AddItem(new ChainChest());
                        AddItem(new RingmailArms());
                        AddItem(new RingmailGloves());
                        AddItem(new PlateGorget());

                        switch (Utility.Random(3))
                        {
                            case 0: AddItem(new CloseHelm()); break;
                            case 1: AddItem(new NorseHelm()); break;
                            case 2: AddItem(new PlateHelm()); break;
                        }

                        BaseWeapon weapon;

                        switch (Utility.Random(4))
                        {
                            default:
                            case 0: weapon = new Broadsword(); break;
                            case 1: weapon = new Longsword(); break;
                            case 2: weapon = new Katana(); break;
                            case 3: weapon = new Axe(); break;
                        }

                        weapon.Quality = WeaponQuality.Exceptional;
                        weapon.Resource = CraftResource.Gold;
                        weapon.Layer = Layer.OneHanded;

                        AddItem(weapon);

                        if (Utility.RandomBool())
                            AddItem(new HeaterShield());
                        else
                            AddItem(new MetalKiteShield());
                    } 
                    break;

                case GuardType.Wizard:
                    {
                        AddItem(new WizardsHat(Utility.RandomGreenHue()));
                        AddItem(new Robe(Utility.RandomGreenHue()));      
   
                        GnarledStaff staff = new GnarledStaff();
                        staff.Attributes.SpellChanneling = 1;
                        staff.Attributes.SpellDamage = Utility.RandomMinMax(4, 8);
                        AddItem(staff);
                    }
                    break;

                case GuardType.Medic:
                    {
                        AddItem(new Bandana(Utility.RandomGreenHue()));
                        AddItem(new Robe(Utility.RandomGreenHue()));

                    } 
                    break;
            }
        }
Example #27
0
        public Guard(GuardType type)
            : this(type, AIType.AI_Melee)
        {

        }
Example #28
0
        public Guard(GuardType type, AIType ai)
            : base(ai, FightMode.Closest, 20, 1, 0.2, 0.4)
        {
            m_Type = type;

                        if (m_Type == GuardType.Wizard)
                ChangeAIType(AIType.AI_Mage);

            if (m_Type == GuardType.Archer)
                ChangeAIType(AIType.AI_Archer);

            if (m_Type == GuardType.Medic)
                ChangeAIType(AIType.AI_Healer);

            Title = GetTitle(type);
            Hue = Utility.RandomSkinHue();
            Karma = 12000;

            if (0.50 >= Utility.RandomDouble())
            {
                Name = NameList.RandomName("female") + ",";
                Female = true;
                Body = 0x191;
            }
            else
            {
                Name = NameList.RandomName("male") + ",";
                Body = 0x190;
                FacialHairItemID = Utility.RandomList(0x203E, 0x203F, 0x2040, 0x2041, 0x204B, 0x204C, 0x204D);
            }

            SetStatsAndSkills(type);

            SetDamage(7, 13);
            SetDamageType(ResistanceType.Physical, 100);

            SetResistance(ResistanceType.Physical, 55, 65);
            SetResistance(ResistanceType.Fire, 40, 50);
            SetResistance(ResistanceType.Cold, 30, 45);
            SetResistance(ResistanceType.Poison, 40, 50);
            SetResistance(ResistanceType.Energy, 50, 60);

            HairItemID = Utility.RandomList(0x203B, 0x203C, 0x203D, 0x2048);
            HairHue = FacialHairHue = Utility.RandomHairHue();

            Backpack pack = new Backpack();
            pack.AddItem(new Bandage(Utility.RandomMinMax(100, 200)));

            this.AddItem(pack);

            AddEquipment(type);

            if (type == GuardType.Cavalry)
            {
                Horse horse = new Horse();
                horse.Body = 0xE4;
                horse.Controlled = true;
                horse.ControlMaster = this;
                horse.ControlOrder = OrderType.Come;
                horse.RawName = "an Imperial War Horse";
                horse.Hue = 1410;
                horse.ItemID = 16033;
                horse.Rider = this;

                horse.RawStr += Utility.RandomMinMax(45, 60);
                horse.RawDex += Utility.RandomMinMax(25, 30);
                horse.RawInt += Utility.RandomMinMax(15, 20);

                horse.SetSkill(SkillName.Wrestling, horse.Skills.Wrestling.Value + Utility.RandomMinMax(15, 20));
                horse.SetSkill(SkillName.Tactics, horse.Skills.Tactics.Value + Utility.RandomMinMax(20, 25));
                horse.SetSkill(SkillName.MagicResist, horse.Skills.MagicResist.Value + Utility.RandomMinMax(30, 40));

            }
        }
Example #29
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            m_Type = (GuardType)reader.ReadInt();
        }
Example #30
0
 public void CreateGuard(StateMachine sm, string name, GuardType type)
 {
     var guard = sm.AddGuard(Condition, type, name);
     guard.AddEffects(Effects);
 }
Example #31
0
        private void SetStatsAndSkills(GuardType type)
        {
            switch (type)
            {
                default:
                case GuardType.Cavalry:
                case GuardType.Pikeman:
                case GuardType.Swordsman:
                    {
                        SetStr(150, 175);
                        SetDex(80, 100);
                        SetInt(65, 80);

                        SetHits(475, 700);

                        SetSkill(SkillName.Tactics, 85, 100);
                        SetSkill(SkillName.Healing, 65, 85);
                        SetSkill(SkillName.Anatomy, 100, 110);
                        SetSkill(SkillName.Wrestling, 95, 110);
                        SetSkill(SkillName.Swords, 95, 105);
                        SetSkill(SkillName.Fencing, 95, 105);
                        SetSkill(SkillName.MagicResist, 95, 105);

                    } break;

                case GuardType.Archer:
                    {
                        SetStr(100, 130);
                        SetDex(125, 140);
                        SetInt(75, 90);

                        SetHits(300, 400);

                        SetSkill(SkillName.Tactics, 85, 100);
                        SetSkill(SkillName.Healing, 65, 85);
                        SetSkill(SkillName.Anatomy, 100, 105);
                        SetSkill(SkillName.Wrestling, 75, 80);
                        SetSkill(SkillName.Archery, 95, 105);
                        SetSkill(SkillName.MagicResist, 95, 105);

                        this.RangeFight = 6;
                    } break;

                case GuardType.Wizard:
                    {
                        SetStr(75, 80);
                        SetDex(100, 125);
                        SetInt(175, 200);

                        SetHits(200, 250);
                        SetMana(200, 300);

                        SetSkill(SkillName.Tactics, 70, 85);
                        SetSkill(SkillName.Wrestling, 70, 85);
                        SetSkill(SkillName.Magery, 100, 130);
                        SetSkill(SkillName.EvalInt, 95, 105);
                        SetSkill(SkillName.Focus, 60, 70);
                        SetSkill(SkillName.Macing, 90, 100);
                        SetSkill(SkillName.MagicResist, 95, 105);
                        SetSkill(SkillName.Meditation, 90, 100);

                    } break;

                case GuardType.Medic:
                    {
                        SetStr(75, 80);
                        SetDex(100, 125);
                        SetInt(175, 200);

                        SetHits(200, 250);
                        SetMana(200, 300);

                        SetSkill(SkillName.Tactics, 40, 55);
                        SetSkill(SkillName.Wrestling, 90, 105);
                        SetSkill(SkillName.Magery, 100, 105);
                        SetSkill(SkillName.EvalInt, 55, 65);
                        SetSkill(SkillName.Focus, 60, 70);
                        SetSkill(SkillName.Meditation, 90, 100);
                        SetSkill(SkillName.MagicResist, 95, 105);

                    } break;
            }
        }
Example #32
0
 public Guard(GuardType type)
     : this(type, AIType.AI_Melee)
 {
 }
Example #33
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            //Maka
            m_GuardTheme = (CraftResource)reader.ReadInt();
            m_GuardType = (GuardType)reader.ReadInt();
            m_Disappears = reader.ReadBool();
        }
Example #34
0
        public Guard AddGuard(ICondition c, GuardType gtype = GuardType.ENTER, string name = null)
        {
            if (string.IsNullOrEmpty(name))
            {
                name = "G" + (_guards.Count + 1);
            }
            else if (_guards.ContainsKey(name))
            {
                throw new CompilerException(ErrorCode.GuardNameReused, "guard '" + name + "' already exists.");
            }

            var guard = new Guard(name, gtype, c);
            _guards.Add(name, guard);
            return guard;
        }
Example #35
0
        private void SetStatsAndSkills(GuardType type)
        {
            switch (type)
            {
            default:
            case GuardType.Cavalry:
            case GuardType.Pikeman:
            case GuardType.Swordsman:
            {
                SetStr(150, 175);
                SetDex(80, 100);
                SetInt(65, 80);

                SetHits(475, 700);

                SetSkill(SkillName.Tactics, 85, 100);
                SetSkill(SkillName.Healing, 65, 85);
                SetSkill(SkillName.Anatomy, 100, 110);
                SetSkill(SkillName.Wrestling, 95, 110);
                SetSkill(SkillName.Swords, 95, 105);
                SetSkill(SkillName.Fencing, 95, 105);
                SetSkill(SkillName.MagicResist, 95, 105);
            } break;

            case GuardType.Archer:
            {
                SetStr(100, 130);
                SetDex(125, 140);
                SetInt(75, 90);

                SetHits(300, 400);

                SetSkill(SkillName.Tactics, 85, 100);
                SetSkill(SkillName.Healing, 65, 85);
                SetSkill(SkillName.Anatomy, 100, 105);
                SetSkill(SkillName.Wrestling, 75, 80);
                SetSkill(SkillName.Archery, 95, 105);
                SetSkill(SkillName.MagicResist, 95, 105);

                this.RangeFight = 6;
            } break;

            case GuardType.Wizard:
            {
                SetStr(75, 80);
                SetDex(100, 125);
                SetInt(175, 200);

                SetHits(200, 250);
                SetMana(200, 300);

                SetSkill(SkillName.Tactics, 70, 85);
                SetSkill(SkillName.Wrestling, 70, 85);
                SetSkill(SkillName.Magery, 100, 130);
                SetSkill(SkillName.EvalInt, 95, 105);
                SetSkill(SkillName.Focus, 60, 70);
                SetSkill(SkillName.Macing, 90, 100);
                SetSkill(SkillName.MagicResist, 95, 105);
                SetSkill(SkillName.Meditation, 90, 100);
            } break;

            case GuardType.Medic:
            {
                SetStr(75, 80);
                SetDex(100, 125);
                SetInt(175, 200);

                SetHits(200, 250);
                SetMana(200, 300);

                SetSkill(SkillName.Tactics, 40, 55);
                SetSkill(SkillName.Wrestling, 90, 105);
                SetSkill(SkillName.Magery, 100, 105);
                SetSkill(SkillName.EvalInt, 55, 65);
                SetSkill(SkillName.Focus, 60, 70);
                SetSkill(SkillName.Meditation, 90, 100);
                SetSkill(SkillName.MagicResist, 95, 105);
            } break;
            }
        }
Example #36
0
        public static void Against <T>(T value, GuardType type)
        {
            switch (value)
            {
            //INTEGER VALUES
            case byte byteTest:
                switch (type)
                {
                case GuardType.Zero when byteTest == 0:
                    throw new GuardException(type, "The value " + byteTest + " is Zero");

                case GuardType.NotZero when byteTest != 0:
                    throw new GuardException(type, "The value " + byteTest + " is not Zero");

                case GuardType.Default when byteTest == default:
                    throw new GuardException(type, "The value " + byteTest + " is default");

                case GuardType.NullOrEmpty:
                    break;
                }
                break;

            case int intTest:
                switch (type)
                {
                case GuardType.Zero when intTest == 0:
                    throw new GuardException(type, "The value " + intTest + " is Zero");

                case GuardType.NotZero when intTest != 0:
                    throw new GuardException(type, "The value " + intTest + " is not Zero");

                case GuardType.Default when intTest == default:
                    throw new GuardException(type, "The value " + intTest + " is default");

                case GuardType.NullOrEmpty:
                    break;
                }
                break;

            case long longTest:
                switch (type)
                {
                case GuardType.Zero when longTest == 0:
                    throw new GuardException(type, "The value " + longTest + " is Zero");

                case GuardType.NotZero when longTest != 0:
                    throw new GuardException(type, "The value " + longTest + " is not Zero");

                case GuardType.Default when longTest == default:
                    throw new GuardException(type, "The value " + longTest + " is default");

                case GuardType.NullOrEmpty:
                    break;
                }
                break;


            //FLOATING POINT VALUES
            case float floatTest:
                switch (type)
                {
                case GuardType.Zero when Math.Abs(floatTest) < float.Epsilon:
                    throw new GuardException(type, "The value " + floatTest + " is Zero");

                case GuardType.NotZero when Math.Abs(floatTest) > float.Epsilon:
                    throw new GuardException(type, "The value " + floatTest + " is not Zero");

                case GuardType.Default when floatTest == default:
                    throw new GuardException(type, "The value " + floatTest + " is default");

                case GuardType.NullOrEmpty:
                    break;
                }
                break;

            case double doubleTest:
                switch (type)
                {
                case GuardType.Zero when Math.Abs(doubleTest) < double.Epsilon:
                    throw new GuardException(type, "The value " + doubleTest + " is Zero");

                case GuardType.NotZero when Math.Abs(doubleTest) > double.Epsilon:
                    throw new GuardException(type, "The value " + doubleTest + " is not Zero");

                case GuardType.Default when doubleTest == default:
                    throw new GuardException(type, "The value " + doubleTest + " is default");

                case GuardType.NullOrEmpty:
                    break;
                }
                break;

            case decimal decimalTest:
                switch (type)
                {
                case GuardType.Zero when Math.Abs(decimalTest) < _decimalEpsilon:
                    throw new GuardException(type, "The value " + decimalTest + " is Zero");

                case GuardType.NotZero when Math.Abs(decimalTest) > _decimalEpsilon:
                    throw new GuardException(type, "The value " + decimalTest + " is not Zero");

                case GuardType.Default when decimalTest == default:
                    throw new GuardException(type, "The value " + decimalTest + " is default");

                case GuardType.NullOrEmpty:
                    break;
                }
                break;

            //STRING VALUES
            case string stringTest:
                switch (type)
                {
                case GuardType.NullOrEmpty when stringTest.IsNullOrEmpty():
                    throw new GuardException(type, "The value " + stringTest + " is NullOrEmpty");

                case GuardType.Default:
                    throw new GuardException(type, "The value " + stringTest + " cannot be Default");

                case GuardType.Zero:
                    throw new GuardException(type, "The value " + stringTest + " cannot be Zero");

                case GuardType.NotZero:
                    throw new GuardException(type, "The value " + stringTest + " cannot be NotZero");
                }
                break;
            }
        }
Example #37
0
        public Guard(GuardType type, AIType ai)
            : base(ai, FightMode.Closest, 20, 1, 0.2, 0.4)
        {
            m_Type = type;

            if (m_Type == GuardType.Wizard)
            {
                ChangeAIType(AIType.AI_Mage);
            }

            if (m_Type == GuardType.Archer)
            {
                ChangeAIType(AIType.AI_Archer);
            }

            if (m_Type == GuardType.Medic)
            {
                ChangeAIType(AIType.AI_Healer);
            }

            Title = GetTitle(type);
            Hue   = Utility.RandomSkinHue();
            Karma = 12000;

            if (0.50 >= Utility.RandomDouble())
            {
                Name   = NameList.RandomName("female") + ",";
                Female = true;
                Body   = 0x191;
            }
            else
            {
                Name             = NameList.RandomName("male") + ",";
                Body             = 0x190;
                FacialHairItemID = Utility.RandomList(0x203E, 0x203F, 0x2040, 0x2041, 0x204B, 0x204C, 0x204D);
            }

            SetStatsAndSkills(type);

            SetDamage(7, 13);
            SetDamageType(ResistanceType.Physical, 100);

            SetResistance(ResistanceType.Physical, 55, 65);
            SetResistance(ResistanceType.Fire, 40, 50);
            SetResistance(ResistanceType.Cold, 30, 45);
            SetResistance(ResistanceType.Poison, 40, 50);
            SetResistance(ResistanceType.Energy, 50, 60);

            HairItemID = Utility.RandomList(0x203B, 0x203C, 0x203D, 0x2048);
            HairHue    = FacialHairHue = Utility.RandomHairHue();

            Backpack pack = new Backpack();

            pack.AddItem(new Bandage(Utility.RandomMinMax(100, 200)));

            this.AddItem(pack);

            AddEquipment(type);

            if (type == GuardType.Cavalry)
            {
                Horse horse = new Horse();
                horse.Body          = 0xE4;
                horse.Controlled    = true;
                horse.ControlMaster = this;
                horse.ControlOrder  = OrderType.Come;
                horse.RawName       = "Caballo del Guardia";
                horse.Hue           = 1410;
                horse.ItemID        = 16033;
                horse.Rider         = this;

                horse.RawStr += Utility.RandomMinMax(45, 60);
                horse.RawDex += Utility.RandomMinMax(25, 30);
                horse.RawInt += Utility.RandomMinMax(15, 20);

                horse.SetSkill(SkillName.Wrestling, horse.Skills.Wrestling.Value + Utility.RandomMinMax(15, 20));
                horse.SetSkill(SkillName.Tactics, horse.Skills.Tactics.Value + Utility.RandomMinMax(20, 25));
                horse.SetSkill(SkillName.MagicResist, horse.Skills.MagicResist.Value + Utility.RandomMinMax(30, 40));
            }
        }