Ejemplo n.º 1
0
 public Card(string name, string type, int range, int damage, string actionType, Weapons.Hitbox actionHitBox, string description)
 {
     this.name = name;
     SetType(type);
     SetAction(actionType, range, damage, actionHitBox);
     this.description = description;
 }
Ejemplo n.º 2
0
        protected override void initShip()
        {
            shipClass = "";

            shipsHull = new Hull();
            shipsWeapons = new Weapons(rand);
            shipShields = new Shield();
        }
        protected override void initShip()
        {
            shipClass = "Attack Ship";

            shipsHull = new Hull(HULL);
            shipsWeapons = new Weapons(rand, WBASE, WRAND);
            shipShields = new Shield(SHIELD, REGEN);
        }
Ejemplo n.º 4
0
 public Card(string name, Weapons.Hitbox hitbox, string element, string type, int range, int damage, string actionType, GameObject prefab, string description, Sprite image)
 {
     this.name = name;
     SetElement(element);
     SetType(type);
     SetAction(hitbox, actionType, range, damage, prefab);
     this.description = description;
     this.image = image;
 }
Ejemplo n.º 5
0
 public ItemWeapon(string wepName, bool wepUnique, Weapons wepType, float dmg, float attkSpeed, int lvlReq)
     : base(weaponName, baseItemType, wepUnique)
 {
     weaponName = wepName;
     weaponType = wepType;
     baseDamage = dmg;
     baseAttackSpeed = attkSpeed;
     lvlRequirement = lvlReq;
 }
        public static FloatingWeapon generateFloatingWeapon(Weapons weapon, GameScreen gameScreen)
        {
            AttachedWeapon tempWeapon = generateAttachedWeapon(weapon, gameScreen, null);

            return new FloatingWeapon(gameScreen, weapon)
                       {
                           ObjectModel = tempWeapon.ObjectModel,
                           BSphere = tempWeapon.ObjectModel.Meshes[0].BoundingSphere
                       };
        }
Ejemplo n.º 7
0
	void Start(){
        if (transform.tag != "Weapon")
            anim = transform.GetComponent<Animation>();

		Actor = GameObject.Find ("Actor");
        topBody = GameObject.Find("topBodyAnim");
        ZombAll = GameObject.Find("ZombieLogic");

        weaponsClass = Actor.GetComponent<Weapons>();
	}
Ejemplo n.º 8
0
    void Start ()
	{
	    _player          = GameObject.Find("Player").         GetComponent<Player>();
        _particleManager = GameObject.Find("ParticleManager").GetComponent<ParticleEffectsManager>();
	    _xForm           = transform;
        _pool            = GameObject.Find("GameManager").    GetComponent<GameManager>().BulletPool;
	    _weapons         = _player.                           GetComponent<Weapons>();
        CreatePath();
        pickupType = PickupType.BulletVel;
        SetPickupType();
	}
Ejemplo n.º 9
0
 void Start()
 {
     anim = GetComponentInChildren<Animator>();
     textAmmo = GameObject.Find("TextAmmo").GetComponent<Text>();
     weapons.Add(gameObject.AddComponent<Pistol>());
     weapons.Add(gameObject.AddComponent<Machinegun>());
     currentWeapon = weapons[currentWeaponIndex];
     anim.SetInteger("WeaponIndex", currentWeaponIndex);
     weapons[0].ammunition = bullet;
     weapons[1].ammunition = bullet;
     weapons[1].enabled = false;
 }
Ejemplo n.º 10
0
        public Context(bool isMock = false)
        {
            Abilities = new Abilities();
            Actions = new Actions();
            Characteristics = new Characteristics();
            Models = new Models();
            Spells = new Spells();
            Triggers = new Triggers();
            Weapons = new Weapons();

            LoadData(isMock);
        }
Ejemplo n.º 11
0
    void Awake()
    {
        xform                     = transform;    
        //TODO: Move this to a private serialized object                         
        _playerSpawnPoint         = GameObject.Find("PlayerSpawnPoint").transform; // set reference to Spawn Point Object
        xform.position            = _playerSpawnPoint.position;                    // Set player pos to spawnPoint pos
        _pool                     = _gm.BulletPool;
        _particleManager          = GameObject.Find("ParticleManager").GetComponent<ParticleEffectsManager>();
        weapons                   = GetComponent<Weapons>();

        GameEventManager.GameStart += GameStart;
    }
Ejemplo n.º 12
0
 public static void SubtractWeaponQuantitie(Weapons weapon)
 {
     if (weapon != Weapons.Normal_Bomb)
     {
         WeaponsQuantities[weapon]--;
         PlayerData dt = ScoreModule.GetPlayerData();
         if (dt != null)
         {
             dt.PlayerWeapons = WeaponsQuantities;
             ScoreModule.SavePlayerData(dt);
         }
     }
 }
Ejemplo n.º 13
0
 private void SetAction(string actionType, int range, int damage, Weapons.Hitbox actionHitBox)
 {
     try
     {
         action = (Actions.Action)Activator.CreateInstance(null, "Assets.Scripts.CardSystem.Actions." + actionType).Unwrap();
         action.Range = range;
         action.Damage = damage;
         action.HitBox = actionHitBox;
     }
     catch (Exception e)
     {
         action = new Error();
         Debug.LogError(e.Message + ": for " + actionType + ".  Setting " + name + "'s action to Error.");
     }
 }
Ejemplo n.º 14
0
 private void SetAction(Weapons.Hitbox hitbox, string actionType, int range, int damage, GameObject prefab)
 {
     try
     {
         action = (Actions.Action)Activator.CreateInstance(null, "Assets.Scripts.CardSystem.Actions." + actionType).Unwrap();
         action.HitBox = hitbox;
         action.Range = range;
         action.Damage = damage;
         action.Prefab = prefab;
         action.Element = this.element;
     }
     catch (Exception e)
     {
         action = new Error();
         Debug.LogError(e.Message + ": for " + actionType + ".  Setting " + name + "'s action to Error.");
     }
 }
Ejemplo n.º 15
0
        public Soldier GetSoldier(Weapons weapon)
        {
            var isAvailable = _cache.ContainsKey(weapon);
            if (isAvailable)
            {

                Console.WriteLine("Read Cache!");
                return _cache[weapon];
            }

            Console.WriteLine("Create Soldier with weapon '{0}'", weapon);

            var soldier = new Soldier("Soldier", new Position(2, 4));
            soldier.SetWeapon(weapon);
            _cache.Add(weapon, soldier);
            return soldier;
        }
Ejemplo n.º 16
0
        public mainPlayer(Vector3 Pos, Vector2 centre, float aspectRatio)
            : base(Pos)
        {
            currentlyEquipped = Weapons.none;

            for (int i = 0; i < bulletlist.Length; i++)
            {
                bulletlist[i] = new Bullet(Pos,100.0f);
                bulletlist[i].Active = false;
            }
            shortRange = new Bullet(Pos, 20.0f);
            LongRange = new Bullet(Pos, 1000.0f);
            shortRange.Active = false;
            LongRange.Active = false;
            available = Weapons.none;

            eyes = new Camera(Pos, Vector3.Zero, Vector3.Up, centre);
            eyes.setPerspectiveProjection(45.0f, aspectRatio, 2.0f, 1000.0f);
        }
Ejemplo n.º 17
0
    // Switch the current weapon
    public void SwitchWeapon(Weapons weapon)
    {
        switch (weapon) {
            case Weapons.laserGun:
                stats = new LaserGun();
                ammo.text = "∞";
                break;
            case Weapons.alienWeapon:
                stats = new AlienWeapon();
                break;
            case Weapons.gravityGun:
                stats = new GravityGun();
                break;
            case Weapons.dummyGun:
                stats = new DummyGun();
                break;
        }

        int index = 0;
        foreach (Transform child in transform) {
            child.gameObject.SetActive(false);
            if (index == (int)weapon)
                child.gameObject.SetActive(true);
            index++;
        }

        currentWeapon = weapon;
        // change weapon in HUD and play sound
        index = 0;
        foreach (GameObject image in weaponImages)
        {
            image.SetActive(false);
            if (index == (int)weapon)
                image.SetActive (true);
            index++;
        }
        weaponText.text = stats.name;
        if (weapon != Weapons.laserGun)
        {
            ammo.text = stats.ammo.ToString();
        }
        StartCoroutine(PlayWeaponAudio());
    }
Ejemplo n.º 18
0
    private void WeaponSwitching()
    {
        if (Input.GetAxis("Mouse ScrollWheel") > 0)
        {
            currentWeapon.enabled = false;
            currentWeaponIndex = (currentWeaponIndex + 1) > weaponsMaxIndex ? currentWeaponIndex : currentWeaponIndex + 1;
            currentWeapon = weapons[currentWeaponIndex];
            anim.SetInteger("WeaponIndex", currentWeaponIndex);
            currentWeapon.enabled = true;
        }
        else if (Input.GetAxis("Mouse ScrollWheel") < 0)
        {
            currentWeapon.enabled = false;
            currentWeaponIndex = (currentWeaponIndex - 1) < 0 ? currentWeaponIndex : currentWeaponIndex - 1;
            currentWeapon = weapons[currentWeaponIndex];
            anim.SetInteger("WeaponIndex", currentWeaponIndex);
            currentWeapon.enabled = true;
        }


    }
        public static AttachedWeapon generateAttachedWeapon(Weapons weapon, GameScreen gameScreen, Ship owner)
        {
            AttachedWeapon aWeapon;
            switch (weapon)
            {
                case Weapons.TestGun:
                    aWeapon = new TestGun(gameScreen, owner);
                    break;

                case Weapons.Fan:
                    aWeapon = new Fan(gameScreen, owner);
                    break;

                case Weapons.RemoteMineLauncher:
                    aWeapon = new RemoteMineLauncher(gameScreen, owner);
                    break;

                default:
                    aWeapon = null;
                    break;
            }

            return aWeapon;
        }
Ejemplo n.º 20
0
        public void init()
        {
            MapController.Init();

            this.Width  = MapController.GetWidth();
            this.Height = MapController.GetHeight();

            dwarfSheet   = new Bitmap(Path.Combine(new DirectoryInfo(Directory.GetCurrentDirectory()).Parent.Parent.FullName.ToString(), "Resources\\playerred2.png"));
            weaponSheet  = new Bitmap(Path.Combine(new DirectoryInfo(Directory.GetCurrentDirectory()).Parent.Parent.FullName.ToString(), "Resources\\weapon3_1.png"));
            weaponSheet1 = new Bitmap(Path.Combine(new DirectoryInfo(Directory.GetCurrentDirectory()).Parent.Parent.FullName.ToString(), "Resources\\weapon2.png"));
            weaponSheet2 = new Bitmap(Path.Combine(new DirectoryInfo(Directory.GetCurrentDirectory()).Parent.Parent.FullName.ToString(), "Resources\\weapon_knight_sword.png"));
            weaponSheet5 = new Bitmap(Path.Combine(new DirectoryInfo(Directory.GetCurrentDirectory()).Parent.Parent.FullName.ToString(), "Resources\\weapon_axe.png"));
            weaponSheet4 = new Bitmap(Path.Combine(new DirectoryInfo(Directory.GetCurrentDirectory()).Parent.Parent.FullName.ToString(), "Resources\\weapon_big_gold.png"));
            weaponSheet6 = new Bitmap(Path.Combine(new DirectoryInfo(Directory.GetCurrentDirectory()).Parent.Parent.FullName.ToString(), "Resources\\weapon_big_hammer.png"));
            chest        = new Bitmap(Path.Combine(new DirectoryInfo(Directory.GetCurrentDirectory()).Parent.Parent.FullName.ToString(), "Resources\\chest.png"));
            mobSheet     = new Bitmap(Path.Combine(new DirectoryInfo(Directory.GetCurrentDirectory()).Parent.Parent.FullName.ToString(), "Resources\\Enemy1.png"));
            mobSheet2    = new Bitmap(Path.Combine(new DirectoryInfo(Directory.GetCurrentDirectory()).Parent.Parent.FullName.ToString(), "Resources\\enemy2.png"));
            mobSheet3    = new Bitmap(Path.Combine(new DirectoryInfo(Directory.GetCurrentDirectory()).Parent.Parent.FullName.ToString(), "Resources\\enemy3.png"));
            mobSheet4    = new Bitmap(Path.Combine(new DirectoryInfo(Directory.GetCurrentDirectory()).Parent.Parent.FullName.ToString(), "Resources\\enemy4.png"));
            mobSheet5    = new Bitmap(Path.Combine(new DirectoryInfo(Directory.GetCurrentDirectory()).Parent.Parent.FullName.ToString(), "Resources\\enemy5.png"));
            mobSheet6    = new Bitmap(Path.Combine(new DirectoryInfo(Directory.GetCurrentDirectory()).Parent.Parent.FullName.ToString(), "Resources\\BOSS.png"));

            bossSheet   = new Bitmap(Path.Combine(new DirectoryInfo(Directory.GetCurrentDirectory()).Parent.Parent.FullName.ToString(), "Resources\\Minotaur - Sprite Sheet.png"));
            heartsImage = new Bitmap(Path.Combine(new DirectoryInfo(Directory.GetCurrentDirectory()).Parent.Parent.FullName.ToString(), "Resources\\hearts2.png"));
            FlaskSheet  = new Bitmap(Path.Combine(new DirectoryInfo(Directory.GetCurrentDirectory()).Parent.Parent.FullName.ToString(), "Resources\\flask_big_blue.png"));

            //enemies
            enemies = new List <Enemy>
            {
                new Enemy(1007, 836, 10, Hero.BossIdleFrames, Hero.BossRunFrames, Hero.BossAttackFrames, Hero.BossDeathFrames, bossSheet),//DO NOT CHANGE BOSS

                new Enemy(200, 520, 1, Hero.EnemyIdleFrames, Hero.EnemyRunFrames, mobSheet),
                new Enemy(248, 341, 1, Hero.EnemyIdleFrames, Hero.EnemyRunFrames, mobSheet),

                new Enemy(542, 701, 2, Hero.Enemy2IdleFrames, Hero.Enemy2RunFrames, mobSheet2),



                new Enemy(143, 1184, 2, Hero.Enemy2IdleFrames, Hero.Enemy2RunFrames, mobSheet2),
                new Enemy(191, 1718, 2, Hero.Enemy2IdleFrames, Hero.Enemy2RunFrames, mobSheet2),
                new Enemy(698, 1757, 2, Hero.Enemy2IdleFrames, Hero.Enemy2RunFrames, mobSheet2),
                new Enemy(38, 185, 1, Hero.EnemyIdleFrames, Hero.EnemyRunFrames, mobSheet),
                new Enemy(290, 1241, 1, Hero.EnemyIdleFrames, Hero.EnemyRunFrames, mobSheet),
                new Enemy(491, 14, 1, Hero.EnemyIdleFrames, Hero.EnemyRunFrames, mobSheet),
                new Enemy(38, 302, 5, Hero.Enemy5IdleFrames, Hero.Enemy5RunFrames, mobSheet5),
                new Enemy(134, 540, 1, Hero.EnemyIdleFrames, Hero.EnemyRunFrames, mobSheet),
                new Enemy(53, 464, 5, Hero.Enemy5IdleFrames, Hero.Enemy5RunFrames, mobSheet5),
                new Enemy(353, 14, 5, Hero.Enemy5IdleFrames, Hero.Enemy5RunFrames, mobSheet5),
                new Enemy(62, 977, 5, Hero.Enemy5IdleFrames, Hero.Enemy5RunFrames, mobSheet5),

                new Enemy(300, 500, 3, Hero.Enemy2IdleFrames, Hero.Enemy2RunFrames, mobSheet3),
                new Enemy(323, 317, 3, Hero.Enemy2IdleFrames, Hero.Enemy2RunFrames, mobSheet3),
                new Enemy(530, 242, 3, Hero.Enemy2IdleFrames, Hero.Enemy2RunFrames, mobSheet3),
                new Enemy(266, 242, 4, Hero.EnemyIdleFrames, Hero.EnemyRunFrames, mobSheet4),
                new Enemy(257, 149, 4, Hero.EnemyIdleFrames, Hero.EnemyRunFrames, mobSheet4),
                new Enemy(527, 449, 4, Hero.EnemyIdleFrames, Hero.EnemyRunFrames, mobSheet4),
                new Enemy(473, 1001, 4, Hero.EnemyIdleFrames, Hero.EnemyRunFrames, mobSheet4),
                new Enemy(290, 1370, 4, Hero.EnemyIdleFrames, Hero.EnemyRunFrames, mobSheet4),
                new Enemy(464, 1757, 4, Hero.EnemyIdleFrames, Hero.EnemyRunFrames, mobSheet4),
                // new Enemy(32, 380, 5,Hero.Enemy5IdleFrames, Hero.Enemy5RunFrames, mobSheet5),
                new Enemy(533, 860, 6, Hero.Enemy2IdleFrames, Hero.Enemy2RunFrames, mobSheet6),
                new Enemy(260, 962, 6, Hero.Enemy2IdleFrames, Hero.Enemy2RunFrames, mobSheet6),
                new Enemy(92, 1577, 6, Hero.Enemy2IdleFrames, Hero.Enemy2RunFrames, mobSheet6),
                new Enemy(974, 1757, 6, Hero.Enemy2IdleFrames, Hero.Enemy2RunFrames, mobSheet6),
                new Enemy(671, 1364, 6, Hero.Enemy2IdleFrames, Hero.Enemy2RunFrames, mobSheet6),
            };

            flasks = new List <staff>
            {
                new staff(125, 1622, 1, FlaskSheet),
                new staff(764, 845, 1, FlaskSheet),
                new staff(995, 635, 1, FlaskSheet),
                new staff(1244, 830, 1, FlaskSheet),
                new staff(1001, 1109, 1, FlaskSheet),
            };


            //player
            player = new Entity(32, 32, Hero.IdleFrames, Hero.runFrames, Hero.attackFrames, Hero.deathFrames, Hero.RedFrames, dwarfSheet);



            //hearts image
            hearts = new hearts(580, 10, Hero.fullHearts, Hero.heartsFrames, heartsImage);
            //weapons
            weapon  = new Weapons(90, 30, 1, weaponSheet);      //20
            weapon1 = new Weapons(995, 1079, 2, weaponSheet1);  //150
            weapon2 = new Weapons(485, 533, 3, weaponSheet2);   //40
            weapon5 = new Weapons(60, 30, 5, weaponSheet5);     //20
            weapon4 = new Weapons(41, 1139, 4, weaponSheet4);   //50
            weapon6 = new Weapons(1127, 1760, 6, weaponSheet6); //70
            weapons.Add(weapon);
            weapons.Add(weapon1);
            weapons.Add(weapon2);
            weapons.Add(weapon5);
            weapons.Add(weapon4);
            weapons.Add(weapon6);



            timer1.Start();
            timer2.Start();
            timer3.Start();
            timer4.Start();
        }
Ejemplo n.º 21
0
 public string GetWeaponName(Weapons iWeaponId)
 {
     return System.Runtime.InteropServices.Marshal.PtrToStringAnsi(Server.Server_GetWeaponName((int)iWeaponId));
 }
Ejemplo n.º 22
0
        private void GenerateShadowedStalker()
        {
            BestialArchetype = BestialArchetypes.ShadowedStalker;

            // Generate base stats
            Stats.WeaponSkill    = 53;
            Stats.BallisticSkill = 0;
            Stats.Strength       = 41;
            Stats.Toughness      = 37;
            Stats.Agility        = 48;
            Stats.Intelligence   = 17;
            Stats.Perception     = 43;
            Stats.WillPower      = 36;
            Stats.Fellowship     = 10;

            BaseMovement = 4;
            Wounds       = 12;

            // Generate Skills
            if (Globals.RollD10() > 5)
            {
                Skills.AcrobaticsAg = 1;
            }
            else
            {
                Skills.ShadowingAg = 1;
            }
            Skills.ConcealmentAg = 1;
            Skills.SilentMoveAg  = 1;
            Skills.TrackingInt   = 3;

            // Generate Talents
            int randValue = Globals.Rand.Next(4);

            if (randValue == 0)
            {
                Talents.AssassinStrike++;
            }
            else if (randValue == 1)
            {
                Talents.CrushingBlow++;
            }
            else if (randValue == 2)
            {
                Talents.FuriousAssault++;
            }
            else
            {
                Talents.TalentedShadowing++;
            }

            // Generate Traits
            Traits.Bestial++;

            randValue = Globals.Rand.Next(2);
            if (randValue == 0)
            {
                Traits.BrutalCharge++;
            }
            else
            {
                Traits.Toxic++;
            }
            Traits.NaturalWeapons++;

            // Generate Weapons (Note that weapon damage bonus is NOT including strength)
            Weapons.Add(new Weapon("Claws, fangs, tentacles, stingers, or other deadly adaption", true, 1, 0, "I or R", 0, true));

            // Generate Bestial Nature
            randValue = Globals.RollD10();
            if (randValue <= 2)
            {
                BestialNature = new DocContentItem("Adapted", 37);
                int numExtrasRemaining = Globals.Rand.Next(1, 5);
                while (numExtrasRemaining > 0)
                {
                    switch (Globals.Rand.Next(6))
                    {
                    case 0:
                        if (Talents.AssassinStrike > 0)
                        {
                            continue;
                        }
                        Talents.AssassinStrike++;
                        break;

                    case 1:
                        if (Talents.CrushingBlow > 0)
                        {
                            continue;
                        }
                        Talents.CrushingBlow++;
                        break;

                    case 2:
                        if (Talents.FuriousAssault > 0)
                        {
                            continue;
                        }
                        Talents.FuriousAssault++;
                        break;

                    case 3:
                        if (Talents.TalentedShadowing > 0)
                        {
                            continue;
                        }
                        Talents.TalentedShadowing++;
                        break;

                    case 4:
                        if (Traits.BrutalCharge > 0)
                        {
                            continue;
                        }
                        Traits.BrutalCharge++;
                        break;

                    case 5:
                        if (Traits.Toxic > 0)
                        {
                            continue;
                        }
                        Traits.Toxic++;
                        break;
                    }
                    numExtrasRemaining--;
                }
            }
            else if (randValue <= 4)
            {
                BestialNature = new DocContentItem("Chameleonic", 37);
                // Special features only, listed in book
            }
            else if (randValue <= 6)
            {
                BestialNature = new DocContentItem("Deadly Ambusher", 37);
                // Special features only, listed in book
            }
            else if (randValue <= 7)
            {
                BestialNature = new DocContentItem("Lure", 37);
                Talents.Mimic++;
            }
            else if (randValue <= 8)
            {
                BestialNature = new DocContentItem("Shadow-walking", 37);
                Traits.Phase++;
            }
            else
            {
                BestialNature = new DocContentItem("Vanisher", 37);
                // Special features only, listed in book
            }
        }
Ejemplo n.º 23
0
        private void GenerateBehemoth()
        {
            BestialArchetype = BestialArchetypes.Behemoth;

            // Generate base stats
            Stats.WeaponSkill    = 40;
            Stats.BallisticSkill = 0;
            Stats.Strength       = 70;
            Stats.Toughness      = 65;
            Stats.Agility        = 28;
            Stats.Intelligence   = 14;
            Stats.Perception     = 26;
            Stats.WillPower      = 37;
            Stats.Fellowship     = 12;

            BaseMovement     = 4;
            Wounds           = 55;
            UniqueArmourName = "Durable hide";

            // Generate Skills
            Skills.AwarenessPer = 1;

            // Generate Talents
            int randValue = Globals.Rand.Next(4);

            if (randValue == 0)
            {
                Talents.CombatMaster++;
            }
            else if (randValue == 1)
            {
                Talents.Fearless++;
            }
            else if (randValue == 2)
            {
                Talents.Hardy++;
            }
            else
            {
                Talents.IronJaw++;
            }

            // Generate Traits
            Traits.Bestial++;
            Traits.NaturalArmour = 5;
            Traits.NaturalWeapons++;
            Traits.Size = XenosSizes.Enormous;
            Traits.UnnaturalStrength++;

            // Generate Weapons (Note that weapon damage bonus is NOT including strength)
            Weapons.Add(new Weapon("Oversized claws, fangs, horns, or other natural weapons", true, 1, 0, "I or R", 0, true));
            Weapon trampleWeapon = new Weapon("Trample", true, 2, 0, "I or R", 2, false)
            {
                SpecialTrait1 = Properties.Settings.Default.ShowPageNumbers ? "Overwhelming (page 36, Stars of Inequity)" : "Overwhelming*"
            };

            Weapons.Add(trampleWeapon);

            // Generate Bestial Nature
            randValue = Globals.RollD10();
            if (randValue <= 2)
            {
                BestialNature = new DocContentItem("Beyond Challenge", 35);
                if (Talents.CombatMaster < 1)
                {
                    Talents.CombatMaster++;
                }
                if (Talents.Fearless < 1)
                {
                    Talents.Fearless++;
                }
                if (Talents.Hardy < 1)
                {
                    Talents.Hardy++;
                }
                if (Talents.IronJaw < 1)
                {
                    Talents.IronJaw++;
                }
            }
            else if (randValue <= 3)
            {
                BestialNature  = new DocContentItem("Impossible Grace", 35);
                Stats.Agility += 20;
            }
            else if (randValue <= 5)
            {
                BestialNature    = new DocContentItem("Leviathan", 35);
                Traits.Size      = XenosSizes.Massive;
                Stats.Strength  += 10;
                Stats.Toughness += 10;
                Wounds          += Globals.RollD10(4);
            }
            else if (randValue <= 7)
            {
                BestialNature = new DocContentItem("Megapredator", 35);
                int randWsIncrease1 = Globals.Rand.Next(1, 21);
                int randWsIncrease2 = Globals.Rand.Next(1, 21);
                if (randWsIncrease1 > randWsIncrease2)
                {
                    Stats.WeaponSkill += randWsIncrease1;
                }
                else
                {
                    Stats.WeaponSkill += randWsIncrease2;
                }
                foreach (Weapon weapon in Weapons)
                {
                    weapon.Primitive = false;
                }
            }
            else if (randValue <= 8)
            {
                BestialNature = new DocContentItem("Titanborn", 35);
                Traits.Size   = XenosSizes.Massive;
                Traits.UnnaturalStrength++;
                Traits.UnnaturalToughness++;
            }
            else
            {
                BestialNature = new DocContentItem("Unstoppable", 35);
                // Only special conditions listed in book
            }
        }
Ejemplo n.º 24
0
        public void checkBulletCollision(Weapons.AbstractBullet bullet)
        {
            if (bullet.isDestroyed) return;

            if (currentHitbox.Intersects(bullet.getHitBox()) && isDead == false)
            {
                // Inflict damage on this player. The removeHealth function returns if this player died.
                if (!bullet.isHit)
                {
                    if (removeHealth(bullet.damageScore))
                    {
                        bullet.ownerPlayer.playerKills++;
                    }
                    bullet.isHit = true;
                }
                if (bullet.isFlameable == false)
                    bullet.isDestroyed = true;
                else
                {
                    // Reset the counter for when the player was last hit by a bullet.
                    lastHitCount = 0;
                    bullet.isExploding = true;
                    // Mark the bullet as destroyed (The corresponding weaponManager will delete the bullet).
                    bullet.runRemovalCounter = true;
                }
            }
        }
Ejemplo n.º 25
0
    public void OnWeaponsSelected(GameObject button)
    {
        WeaponType = button.GetComponent<WeaponsClass>().weapon;

        GameObject.Find("WeaponsCombo").transform.FindChild("Text").GetComponent<Text>().text= WeaponType.ToString().Replace("_", " ");
        GameObject.Find("WeaponsCombo").transform.FindChild("Border").gameObject.SetActive(false);
        lastButton = button;


        WeaponConfigWhenComboSelected();
    }
Ejemplo n.º 26
0
        public virtual IQueryable <TEntity> Set <TEntity>()
            where TEntity : class
        {
            if (typeof(TEntity) == typeof(City))
            {
                return((IQueryable <TEntity>)Cities.AsQueryable());
            }

            if (typeof(TEntity) == typeof(CogTag))
            {
                return((IQueryable <TEntity>)Tags.AsQueryable());
            }

            if (typeof(TEntity) == typeof(Faction))
            {
                return((IQueryable <TEntity>)Factions.AsQueryable());
            }

            if (typeof(TEntity) == typeof(LocustHorde))
            {
                return((IQueryable <TEntity>)Factions.OfType <LocustHorde>().AsQueryable());
            }

            if (typeof(TEntity) == typeof(Gear))
            {
                return((IQueryable <TEntity>)Gears.AsQueryable());
            }

            if (typeof(TEntity) == typeof(Officer))
            {
                return((IQueryable <TEntity>)Gears.OfType <Officer>().AsQueryable());
            }

            if (typeof(TEntity) == typeof(Mission))
            {
                return((IQueryable <TEntity>)Missions.AsQueryable());
            }

            if (typeof(TEntity) == typeof(Squad))
            {
                return((IQueryable <TEntity>)Squads.AsQueryable());
            }

            if (typeof(TEntity) == typeof(SquadMission))
            {
                return((IQueryable <TEntity>)SquadMissions.AsQueryable());
            }

            if (typeof(TEntity) == typeof(Weapon))
            {
                return((IQueryable <TEntity>)Weapons.AsQueryable());
            }

            if (typeof(TEntity) == typeof(LocustLeader))
            {
                return((IQueryable <TEntity>)LocustLeaders.AsQueryable());
            }

            if (typeof(TEntity) == typeof(LocustHighCommand))
            {
                return((IQueryable <TEntity>)LocustHighCommands.AsQueryable());
            }

            throw new InvalidOperationException("Invalid entity type: " + typeof(TEntity));
        }
Ejemplo n.º 27
0
 void InitializeDatabaseInterfaces()
 {
     Weapons.SetupDatabaseInterface();
     //TacticStates.SetupDatabaseInterface();
     Actions.SetupDatabaseInterface();
 }
Ejemplo n.º 28
0
 //this function adds values to the static variables initially
 public void Creation(string job, string incomingName, int startHealth, int strength, int magic, Weapons starterWeapon)
 {
     classInfo   = job;
     playerName  = incomingName;
     maxHealth   = startHealth;
     attackPwr   = strength;
     magicPwr    = magic;
     weapon      = new WeaponData(starterWeapon.weapon.GetWeaponName(), starterWeapon.weapon.GetWeaponPwr(), starterWeapon.weapon.GetWeaponDescrpt());
     currHealth  = startHealth;
     exp         = 0;
     gold        = 0;
     maxMP       = 20;
     currMP      = 20;
     level       = 1;
     missionList = new List <QuestData>();
     gps         = "Overword";
 }
Ejemplo n.º 29
0
        private void CalculateEffectsFromTraits()
        {
            if (Traits.Apex > 0)
            {
                Stats.WeaponSkill += 10;
                Stats.Strength    += 10;
                Stats.Toughness   += 10;
                Stats.Agility     += 10;
                Stats.Perception  += 10;
                Talents.SwiftAttack++;
                Traits.ImprovedNaturalWeapons++;

                if (Traits.Apex > 1)
                {
                    Traits.UnnaturalStrength++;
                    Traits.UnnaturalToughness++;
                }
            }

            if (Traits.Amorphous > 0)
            {
                AmorphousMovement = true;
                Stats.Toughness  += 10;
                Traits.StrangePhysiology++;
                Traits.UnnaturalSenses += 15;
                if (Traits.Fear >= 2)
                {
                    Traits.Fear++;
                }
                else
                {
                    Traits.Fear = 2;
                }
                if (Globals.RollD100() <= 50)
                {
                    Skills.ClimbSt++;
                }
                if (Globals.RollD100() <= 50)
                {
                    Skills.SwimSt++;
                }
            }

            if (Traits.Amphibious > 0)
            {
                Skills.SwimSt = 3;
            }

            if (Traits.Arboreal > 0)
            {
                Skills.AcrobaticsAg = 3;
                Skills.ClimbSt      = 3;
                Skills.DodgeAg      = 3;
                Talents.Catfall++;
            }

            if (Traits.Armoured > 0)
            {
                for (int i = 0; i < Traits.Armoured; i++)
                {
                    if (Traits.NaturalArmour <= 0)
                    {
                        Traits.NaturalArmour = Globals.RollD5();
                    }
                    else
                    {
                        Traits.NaturalArmour += 2;
                        if (Traits.NaturalArmour > 8)
                        {
                            Traits.NaturalArmour = 8;
                        }
                    }
                }
            }

            if (Traits.Crawler > 0)
            {
                const int baseChance = 25;
                int       baseBonus  = 5 * (Traits.Crawler - 1);
                if (baseBonus > 20)
                {
                    baseBonus = 20;
                }
                if (Globals.RollD100() <= baseChance + baseBonus)
                {
                    Skills.ClimbSt++;
                }
            }

            if (Traits.Darkling > 0)
            {
                Traits.Blind++;
                if (Globals.RollD100() <= 50)
                {
                    Traits.SonarSense++;
                }
                else
                {
                    Traits.UnnaturalSenses += 30;
                }
                Skills.AwarenessPer++;
                Skills.SilentMoveAg++;
                if (Globals.RollD10() <= 3)
                {
                    Skills.ClimbSt++;
                    Skills.SwimSt++;
                }
                if (Traits.Fear < 1 && Globals.RollD100() <= 10)
                {
                    Traits.Fear = 1;
                }
            }

            if (Traits.Deadly > 0)
            {
                Stats.WeaponSkill += 10;
                Traits.ImprovedNaturalWeapons++;
                if (Traits.Deadly > 1)
                {
                    foreach (Weapon weapon in Weapons)
                    {
                        if (weapon.IsNaturalWeapon)
                        {
                            weapon.RazorSharp = true;
                        }
                    }
                }
                if (Traits.Deadly > 2)
                {
                    Stats.WeaponSkill += 10 * (Traits.Deadly - 2);
                }
            }

            if (Traits.Deathdweller > 0)
            {
                Talents.ResistanceRadiation++;
                Wounds += 3;

                for (int i = 1; i < Traits.Deathdweller; i++)
                {
                    Stats.Toughness += 5;
                    Wounds          += 2;
                }
            }

            if (Traits.Disturbing > 0)
            {
                for (int i = 0; i < Traits.Disturbing; i++)
                {
                    Traits.Fear++;
                }
            }

            if (Traits.FadeKind > 0)
            {
                if (Globals.RollD100() <= 50)
                {
                    Traits.Incorporeal++;
                }
                else
                {
                    Traits.Phase++;
                }
                if (Globals.RollD100() <= 25)
                {
                    Traits.Fear++;
                }
            }

            if (Traits.Flexible > 0)
            {
                foreach (Weapon weapon in Weapons)
                {
                    if (weapon.IsNaturalWeapon)
                    {
                        weapon.Flexible = true;
                    }
                }
                if (Skills.DodgeAg > 0)
                {
                    Skills.DodgeAg++;
                }
                else
                {
                    Skills.DodgeAg = 2;
                }

                if (Traits.Flexible > 1)
                {
                    foreach (Weapon weapon in Weapons)
                    {
                        if (weapon.IsNaturalWeapon)
                        {
                            weapon.Snare = true;
                        }
                    }
                }

                for (int i = 2; i < Traits.Flexible; i++)
                {
                    Stats.Agility += 10;
                }
            }

            if (Traits.Gestalt > 0)
            {
                Stats.Toughness    += 10;
                Stats.WillPower    += 10;
                Stats.Intelligence -= 10;
            }

            if (Traits.Mighty > 0)
            {
                Stats.Strength += 10;
                if (Traits.Mighty > 1)
                {
                    Traits.UnnaturalStrength++;
                }
            }

            if (Traits.Paralytic > 0)
            {
                foreach (Weapon weapon in Weapons)
                {
                    if (weapon.IsNaturalWeapon)
                    {
                        weapon.Toxic = true;
                    }
                }
            }

            if (Traits.ProjectileAttack > 0)
            {
                if (Stats.BallisticSkill < 30)
                {
                    Stats.BallisticSkill = 30;
                }
                Weapon weapon = new Weapon("Projectile attack", false, 1, 3, "I, R, or E", 0, true)
                {
                    Range = 15
                };
                for (int i = 1; i < Traits.ProjectileAttack; i++)
                {
                    weapon.Range += 10;
                    weapon.DamageBonus++;
                    weapon.Penetration++;
                    Stats.BallisticSkill += 10;
                }
                Weapons.Add(weapon);
            }

            if (Traits.Resilient > 0)
            {
                Stats.Toughness += 10;
                if (Traits.Resilient > 1)
                {
                    Traits.UnnaturalToughness++;
                }
            }

            if (Traits.Silicate > 0)
            {
                Stats.Agility -= 10;
                int randomArmour = Globals.RollD5() + 1;
                if (randomArmour > Traits.NaturalArmour)
                {
                    Traits.NaturalArmour = randomArmour;
                }
                Traits.UnnaturalStrength++;
                Traits.UnnaturalToughness++;
            }

            if (Traits.Stealthy > 0)
            {
                Skills.ConcealmentAg = 3;
                Skills.ShadowingAg   = 3;
                Skills.SilentMoveAg  = 3;
                if (Traits.Stealthy > 1)
                {
                    Skills.ConcealmentAg = 4;
                    Skills.ShadowingAg   = 4;
                    Skills.SilentMoveAg  = 4;
                }
            }

            if (Traits.SustainedLife > 1)
            {
                if (Traits.FlyerAgilityModified <= 0)
                {
                    Traits.FlyerAgilityModified = 1;
                }
            }

            if (Traits.Swift > 0)
            {
                Stats.Agility += 10;
                for (int i = 1; i < Traits.Swift; i++)
                {
                    Traits.UnnaturalSpeed++;
                }
            }

            if (Traits.ThermalAdaptionCold > 0)
            {
                Stats.Toughness += 5;
                Talents.ResistanceCold++;
            }

            if (Traits.ThermalAdaptionHeat > 0)
            {
                Stats.Toughness += 5;
                Talents.ResistanceHeat++;
            }

            if (Traits.Tunneller > 0)
            {
                Traits.Burrower = GetTotalStrengthBonus();
                for (int i = 1; i < Traits.Tunneller; i++)
                {
                    Traits.Burrower += 2;
                }
            }

            if (Traits.Unkillable > 0)
            {
                Wounds += 5 + (Traits.Unkillable - 1) * 2;
                Traits.Regeneration = Traits.Unkillable;
            }

            if (Traits.UprootedMovement > 0)
            {
                DoesNotMove = false;
            }

            if (Traits.Venomous > 0)
            {
                foreach (Weapon weapon in Weapons)
                {
                    if (weapon.IsNaturalWeapon)
                    {
                        weapon.Toxic = true;
                    }
                }
            }

            if (Traits.MultipleArms > 0)
            {
                Stats.Toughness += 10;
            }

            // Final calculations
            if (Traits.ImprovedNaturalWeapons > 0)
            {
                foreach (Weapon weapon in Weapons)
                {
                    if (weapon.IsNaturalWeapon)
                    {
                        weapon.Primitive = false;
                        if (Traits.ImprovedNaturalWeapons > 1)
                        {
                            weapon.DamageBonus += 2;
                        }
                    }
                }
            }

            while (Talents.SwiftAttack > 1)
            {
                Talents.SwiftAttack--;
                if (Talents.LightningAttack > 0)
                {
                    Stats.WeaponSkill += 10;
                }
                else
                {
                    Talents.LightningAttack++;
                }
            }

            if (Traits.FlyerAgilityModified > 0)
            {
                int flyValue = Stats.AgilityBonus * Traits.FlyerAgilityModified;
                if (flyValue > Traits.Flyer)
                {
                    Traits.Flyer = flyValue;
                }
                Traits.FlyerAgilityModified = 0;
            }
        }
        protected override void update_option_change(bool right, bool trigger)
        {
            Test_Battle_Character_Data test_battler = this.test_battler;

            switch (Index)
            {
            // Generic
            case 0:
                test_battler.Generic = !test_battler.Generic;
                if (test_battler.Generic)
                {
                    test_battler.Class_Id = Test_Battle_Character_Data.default_class_id;
                    test_battler.Build    = Generic_Builds.Strong;
                    test_battler.Level    = 1;
                    change_generic_actor();
                }
                else
                {
                    test_battler.Actor_Id = 1;
                    change_actor();
                }
                if (!same_unit)
                {
                    setup_actor(test_battler);
                }
                break;

            case 1:
                if (test_battler.Generic)
                {
                    // Class Id
                    test_battler.Class_Id = Classes[
                        (Classes.IndexOf(test_battler.Class_Id) + Classes.Count + (right ? 1 : -1)) % Classes.Count];
                    change_generic_actor();
                }
                else
                {
                    // Actor Id
                    test_battler.Actor_Id = Actors[
                        (Actors.IndexOf(test_battler.Actor_Id) + Actors.Count + (right ? 1 : -1)) % Actors.Count];
                    change_actor();
                }
                if (!same_unit)
                {
                    setup_actor(test_battler);
                }
                break;

            // Weapon
            case 2:
                if (trigger)
                {
                    test_battler.Weapon_Id = next_weapon_group(right, test_battler.Weapon_Id);
                    if (test_battler.Weapon_Id == 0)
                    {
                        test_battler.Weapon_Id = next_weapon_group(right, test_battler.Weapon_Id);
                    }
                }
                else
                {
                    test_battler.Weapon_Id = Weapons[
                        (Weapons.IndexOf(test_battler.Weapon_Id) + Weapons.Count +
                         (Global.Input.pressed(Inputs.Y) ? 5 : 1) * (right ? 1 : -1)) % Weapons.Count];
                }

                actor.clear_items();
                actor.gain_item(new Item_Data(Item_Data_Type.Weapon, test_battler.Weapon_Id, 1));
                test_battler.Items[0] = actor.items[0];
                validate_weapon(actor);
                break;

            // Level
            case 3:
                if (right)
                {
                    if (test_battler.Level < actor.level_cap())
                    {
                        test_battler.Level++;
                    }
                }
                else
                {
                    int min = 1;
                    if (!Global.ActorConfig.ResetLevelOnPromotion)
                    {
                        min = Math.Max(1,
                                       Global.ActorConfig.LevelsBeforeTier(test_battler.Tier));
                    }

                    if (test_battler.Generic)
                    {
                        if (test_battler.Level > min)
                        {
                            test_battler.Level--;
                        }
                    }
                    else
                    {
                        Data_Actor actor_data = Global.data_actors[test_battler.Actor_Id];
                        if (test_battler.Level > (actor.tier == Global.data_classes[actor_data.ClassId].Tier ?
                                                  Global.data_actors[test_battler.Actor_Id].Level : min))
                        {
                            test_battler.Level--;
                        }
                    }
                }
                setup_actor(test_battler);
                break;

            // Prepromote levels
            case 4:
                int minLevel, maxLevel;
                PrepromoteLevels(test_battler, out minLevel, out maxLevel);

                // Increase
                if (right)
                {
                    if (test_battler.Prepromote_Levels < maxLevel)
                    {
                        test_battler.Prepromote_Levels++;
                    }
                }
                // Decrease
                else
                {
                    if (test_battler.Prepromote_Levels > minLevel)
                    {
                        test_battler.Prepromote_Levels--;
                    }
                }

                setup_actor(test_battler);
                break;

            case 5:
                // Build
                if (test_battler.Generic)
                {
                    test_battler.Build = (Generic_Builds)(MathHelper.Clamp((int)test_battler.Build + (right ? 1 : -1),
                                                                           (int)Generic_Builds.Weak, (int)Generic_Builds.Strong));
                }
                // Tier
                else
                {
                    ChangeTier(test_battler, right);
                }
                setup_actor(test_battler);
                break;

            case 6:
                // Gender
                if (test_battler.Generic)
                {
                    test_battler.Gender = (int)(MathHelper.Clamp(test_battler.Gender + (right ? 1 : -1), 0, 5));
                    actor.gender        = test_battler.Gender;
                }
                break;
            }
            refresh();
        }
Ejemplo n.º 31
0
 public void AddWeapon(Weapon item)
 {
     Weapons.Add(item);
 }
 public Inventory()
 {
     //Character Inventory array
     _playerList[0] = new Weapons("Fist", 1, 1, 1, 1, 0, "Real men will use nothing but bare hands!");
 }
Ejemplo n.º 33
0
 // Use this for initialization
 void Start()
 {
     mainWeapon = gameObject.GetComponent("WSimpleShooter") as Weapons;
 }
Ejemplo n.º 34
0
        public void Read()
        {
            //TODO: Read it from file

            int startTexture = ActorCollection <Actor> .START_TEXTURE;

            if (ActorTypeID == ActorType.Guard)
            {
                #region Guard
                //atributes

                HitPoints[(int)Difficulty.None]   = 25;
                HitPoints[(int)Difficulty.Easy]   = 25;
                HitPoints[(int)Difficulty.Medium] = 25;
                HitPoints[(int)Difficulty.Hard]   = 25;
                MaxSpeed   = 0.012f;
                MaxForce   = 0.030f;
                HasPain    = true;
                Score      = 5000;
                WeaponType = Weapons.Pistol;

                //idle animation
                animation[0].Name = "idle";
                animation[0].MustBeAnimatedFromDistinctAngles = true;
                KeyFrame keyFrame = new KeyFrame();
                keyFrame.Duration = 1;
                keyFrame.Frame    = 0;
                animation[0].SetKeyFrame(0, keyFrame);


                //walk animation
                animation[1].Name = "walk";
                animation[1].MustBeAnimatedFromDistinctAngles = true;

                float    duration     = 0.2f;
                KeyFrame keyFrameRun1 = new KeyFrame();
                keyFrameRun1.Duration = duration;
                keyFrameRun1.Frame    = 58 - startTexture;
                animation[1].SetKeyFrame(0, keyFrameRun1);


                KeyFrame keyFrameRun2 = new KeyFrame();
                keyFrameRun2.Duration = duration;
                keyFrameRun2.Frame    = 66 - startTexture;
                animation[1].SetKeyFrame(1, keyFrameRun2);


                KeyFrame keyFrameRun3 = new KeyFrame();
                keyFrameRun3.Duration = duration;
                keyFrameRun3.Frame    = 74 - startTexture;
                animation[1].SetKeyFrame(2, keyFrameRun3);

                KeyFrame keyFrameRun4 = new KeyFrame();
                keyFrameRun4.Duration = duration;
                keyFrameRun4.Frame    = 82 - startTexture;
                animation[1].SetKeyFrame(3, keyFrameRun4);

                //attack
                float durationAttack = 0.4f;

                animation[2].Name = "attack";
                animation[2].MustBeAnimatedFromDistinctAngles = false;

                KeyFrame keyFrameRun411 = new KeyFrame();
                keyFrameRun411.Duration = durationAttack;
                keyFrameRun411.SetScript(0, "playsound Sound/Sfx/049");
                keyFrameRun411.Frame = 97 - startTexture;
                animation[2].SetKeyFrame(0, keyFrameRun411);


                KeyFrame keyFrameRun51 = new KeyFrame();
                keyFrameRun51.Duration = durationAttack;
                keyFrameRun51.SetScript(0, "playsound Sound/Sfx/049");
                keyFrameRun51.Frame = 98 - startTexture;
                animation[2].SetKeyFrame(1, keyFrameRun51);

                //pain animation
                animation[3].Name = "pain";
                animation[3].MustBeAnimatedFromDistinctAngles = false;

                KeyFrame keyFrameRun41111 = new KeyFrame();
                keyFrameRun41111.Duration = 1;
                keyFrameRun41111.Frame    = 90 - startTexture;
                animation[3].SetKeyFrame(0, keyFrameRun41111);


                //falling animation
                float durationKilled = 0.1f;

                animation[4].Name = "falling";
                animation[4].MustBeAnimatedFromDistinctAngles = false;

                KeyFrame keyFrameRun4111 = new KeyFrame();
                keyFrameRun4111.Duration = durationKilled;
                keyFrameRun4111.Frame    = 90 - startTexture;
                animation[4].SetKeyFrame(0, keyFrameRun4111);

                KeyFrame keyFrameRun411111 = new KeyFrame();
                keyFrameRun411111.Duration = durationKilled;
                keyFrameRun411111.Frame    = 91 - startTexture;
                animation[4].SetKeyFrame(1, keyFrameRun411111);

                KeyFrame keyFrameRun41112 = new KeyFrame();
                keyFrameRun41112.Duration = durationKilled;
                keyFrameRun41112.Frame    = 92 - startTexture;
                animation[4].SetKeyFrame(2, keyFrameRun41112);

                KeyFrame keyFrameRun41113 = new KeyFrame();
                keyFrameRun41113.Duration = durationKilled;
                keyFrameRun41113.Frame    = 93 - startTexture;
                keyFrameRun41113.SetScript(0, "playsound Sound/Sfx/086");
                animation[4].SetKeyFrame(3, keyFrameRun41113);


                KeyFrame keyFrameRun41114 = new KeyFrame();
                keyFrameRun41114.Duration = durationKilled;
                keyFrameRun41114.Frame    = 95 - startTexture;
                keyFrameRun41114.SetScript(0, "killme");//very important to sync with state machine
                animation[4].SetKeyFrame(4, keyFrameRun41114);


                //killed animation
                float durationBones = 1;

                animation[5].Name = "killed";
                animation[5].MustBeAnimatedFromDistinctAngles = false;

                KeyFrame keyFrameRun511 = new KeyFrame();
                keyFrameRun511.Duration = durationBones;
                keyFrameRun511.Frame    = 95 - startTexture;
                animation[5].SetKeyFrame(0, keyFrameRun511);
                #endregion
            }
            else if (ActorTypeID == ActorType.Dog)
            {
                #region Dog
                //atributes
                HitPoints[(int)Difficulty.None]   = 1;
                HitPoints[(int)Difficulty.Easy]   = 1;
                HitPoints[(int)Difficulty.Medium] = 1;
                HitPoints[(int)Difficulty.Hard]   = 1;
                MaxSpeed = 0.018f;
                MaxForce = 0.040f;
                HasPain  = false;
                MustGetCloseEnoughToAttack = true;
                Score      = 200;
                WeaponType = Weapons.Knife;

                //idle animation
                animation[0].Name = "idle";
                animation[0].MustBeAnimatedFromDistinctAngles = false;
                KeyFrame keyFrame = new KeyFrame();
                keyFrame.Duration = 1;
                keyFrame.Frame    = 115 - startTexture;
                animation[0].SetKeyFrame(0, keyFrame);


                //walk animation
                animation[1].Name = "walk";
                animation[1].MustBeAnimatedFromDistinctAngles = true;

                float    duration     = 0.2f;
                KeyFrame keyFrameRun1 = new KeyFrame();
                keyFrameRun1.Duration = duration;
                keyFrameRun1.Frame    = 99 - startTexture;
                animation[1].SetKeyFrame(0, keyFrameRun1);


                KeyFrame keyFrameRun2 = new KeyFrame();
                keyFrameRun2.Duration = duration;
                keyFrameRun2.Frame    = 107 - startTexture;
                animation[1].SetKeyFrame(1, keyFrameRun2);


                KeyFrame keyFrameRun3 = new KeyFrame();
                keyFrameRun3.Duration = duration;
                keyFrameRun3.Frame    = 115 - startTexture;
                animation[1].SetKeyFrame(2, keyFrameRun3);

                KeyFrame keyFrameRun4 = new KeyFrame();
                keyFrameRun4.Duration = duration;
                keyFrameRun4.Frame    = 123 - startTexture;
                animation[1].SetKeyFrame(3, keyFrameRun4);

                //attack
                float durationAttack = 0.4f;

                animation[2].Name = "attack";
                animation[2].MustBeAnimatedFromDistinctAngles = false;

                KeyFrame keyFrameRun411 = new KeyFrame();
                keyFrameRun411.Duration = durationAttack;
                keyFrameRun411.Frame    = 135 - startTexture;
                animation[2].SetKeyFrame(0, keyFrameRun411);

                KeyFrame keyFrameRun51 = new KeyFrame();
                keyFrameRun51.Duration = durationAttack;
                keyFrameRun51.SetScript(0, "playsound Sound/Sfx/002");
                keyFrameRun51.Frame = 136 - startTexture;
                animation[2].SetKeyFrame(1, keyFrameRun51);

                KeyFrame keyFrameRun517 = new KeyFrame();
                keyFrameRun517.Duration = durationAttack;
                keyFrameRun517.SetScript(0, "playsound Sound/Sfx/002");
                keyFrameRun517.Frame = 137 - startTexture;
                animation[2].SetKeyFrame(2, keyFrameRun517);

                //falling animation
                float durationKilled = 0.1f;

                animation[4].Name = "falling";
                animation[4].MustBeAnimatedFromDistinctAngles = false;

                KeyFrame keyFrameRun4111 = new KeyFrame();
                keyFrameRun4111.SetScript(0, "playsound Sound/Sfx/035");
                keyFrameRun4111.Duration = durationKilled;
                keyFrameRun4111.Frame    = 131 - startTexture;
                animation[4].SetKeyFrame(0, keyFrameRun4111);

                KeyFrame keyFrameRun411111 = new KeyFrame();
                keyFrameRun411111.Duration = durationKilled;
                keyFrameRun411111.Frame    = 132 - startTexture;
                animation[4].SetKeyFrame(1, keyFrameRun411111);

                KeyFrame keyFrameRun41112 = new KeyFrame();
                keyFrameRun41112.Duration = durationKilled;
                keyFrameRun41112.Frame    = 133 - startTexture;
                animation[4].SetKeyFrame(2, keyFrameRun41112);

                KeyFrame keyFrameRun41113 = new KeyFrame();
                keyFrameRun41113.Duration = durationKilled;
                keyFrameRun41113.Frame    = 134 - startTexture;
                keyFrameRun41113.SetScript(0, "killme");//very important to sync with state machine
                animation[4].SetKeyFrame(3, keyFrameRun41113);


                //killed animation
                float durationBones = 1;

                animation[5].Name = "killed";
                animation[5].MustBeAnimatedFromDistinctAngles = false;

                KeyFrame keyFrameRun511 = new KeyFrame();
                keyFrameRun511.Duration = durationBones;
                keyFrameRun511.Frame    = 134 - startTexture;
                animation[5].SetKeyFrame(0, keyFrameRun511);

                #endregion
            }
            else if (ActorTypeID == ActorType.Gretel_Grosse)
            {
                #region Boss
                HitPoints[(int)Difficulty.None]   = 850;
                HitPoints[(int)Difficulty.Easy]   = 950;
                HitPoints[(int)Difficulty.Medium] = 1050;
                HitPoints[(int)Difficulty.Hard]   = 1200;
                MaxSpeed   = 0.010f;
                MaxForce   = 0.025f;
                HasPain    = false;
                Score      = 5000;
                WeaponType = Weapons.GatlingGun;


                //walk animation
                animation[0].Name = "walk";
                animation[0].MustBeAnimatedFromDistinctAngles = false;

                float    duration     = 0.2f;
                KeyFrame keyFrameRun1 = new KeyFrame();
                keyFrameRun1.Duration = duration;
                keyFrameRun1.Frame    = 385 - startTexture;
                keyFrameRun1.SetScript(0, "playsound xyz");
                animation[0].SetKeyFrame(0, keyFrameRun1);


                KeyFrame keyFrameRun2 = new KeyFrame();
                keyFrameRun2.Duration = duration;
                keyFrameRun2.Frame    = 386 - startTexture;
                animation[0].SetKeyFrame(1, keyFrameRun2);


                KeyFrame keyFrameRun3 = new KeyFrame();
                keyFrameRun3.Duration = duration;
                keyFrameRun3.Frame    = 387 - startTexture;
                animation[0].SetKeyFrame(2, keyFrameRun3);

                KeyFrame keyFrameRun4 = new KeyFrame();
                keyFrameRun4.Duration = duration;
                keyFrameRun4.Frame    = 388 - startTexture;
                animation[0].SetKeyFrame(3, keyFrameRun4);


                //attack animation
                float durationAttack = 0.4f;

                animation[1].Name = "attack";
                animation[1].MustBeAnimatedFromDistinctAngles = false;

                KeyFrame keyFrameRun41 = new KeyFrame();
                keyFrameRun41.Duration = durationAttack;
                keyFrameRun41.Frame    = 389 - startTexture;
                keyFrameRun41.SetScript(0, "playsound Sound/Sfx/013");
                animation[1].SetKeyFrame(0, keyFrameRun41);


                KeyFrame keyFrameRun5 = new KeyFrame();
                keyFrameRun5.Duration = durationAttack;
                keyFrameRun5.SetScript(0, "playsound Sound/Sfx/013");
                keyFrameRun5.Frame = 390 - startTexture;
                animation[1].SetKeyFrame(1, keyFrameRun5);


                KeyFrame keyFrameRun6 = new KeyFrame();
                keyFrameRun6.Duration = durationAttack;
                keyFrameRun6.Frame    = 391 - startTexture;
                animation[1].SetKeyFrame(2, keyFrameRun6);


                //idle animation
                float durationIdle = 0.4f;

                animation[2].Name = "idle";
                animation[2].MustBeAnimatedFromDistinctAngles = false;

                KeyFrame keyFrameRun42 = new KeyFrame();
                keyFrameRun42.Duration = durationIdle;
                keyFrameRun42.Frame    = 385 - startTexture;
                keyFrameRun42.SetScript(0, "playsound Sound/Sfx/013");
                animation[2].SetKeyFrame(0, keyFrameRun41);


                //falling animation
                float durationKilled = 0.1f;

                animation[3].Name = "falling";
                animation[3].MustBeAnimatedFromDistinctAngles = false;

                KeyFrame keyFrameRun4111 = new KeyFrame();
                keyFrameRun4111.Duration = durationKilled;
                keyFrameRun4111.Frame    = 393 - startTexture;
                animation[3].SetKeyFrame(0, keyFrameRun4111);

                KeyFrame keyFrameRun411111 = new KeyFrame();
                keyFrameRun411111.Duration = durationKilled;
                keyFrameRun411111.Frame    = 394 - startTexture;
                animation[3].SetKeyFrame(1, keyFrameRun411111);

                KeyFrame keyFrameRun41114 = new KeyFrame();
                keyFrameRun41114.Duration = durationKilled;
                keyFrameRun41114.Frame    = 395 - startTexture;
                animation[3].SetKeyFrame(2, keyFrameRun41114);


                KeyFrame keyFrameRun5115 = new KeyFrame();
                keyFrameRun5115.Duration = durationKilled;
                keyFrameRun5115.Frame    = 392 - startTexture;
                keyFrameRun5115.SetScript(0, "killme"); //very important to sync with state machine
                animation[3].SetKeyFrame(3, keyFrameRun5115);

                //killed animation
                float durationBones = 0.1f;

                animation[4].Name = "killed";
                animation[4].MustBeAnimatedFromDistinctAngles = false;

                KeyFrame keyFrameRun511 = new KeyFrame();
                keyFrameRun511.Duration = durationBones;
                keyFrameRun511.Frame    = 392 - startTexture;
                animation[4].SetKeyFrame(0, keyFrameRun511);

                #endregion
            }
        }
Ejemplo n.º 35
0
        public void EquipmentCommand(Client player, string action, string type = "")
        {
            if (player.GetData(EntityData.PLAYER_KILLED) != 0)
            {
                player.SendChatMessage(Constants.COLOR_ERROR + Messages.ERR_PLAYER_IS_DEAD);
            }
            else if (player.HasData(EntityData.PLAYER_IN_LSPD_ROOM_LOCKERS_AREA) == false)
            {
                player.SendChatMessage(Constants.COLOR_ERROR + Messages.ERR_PLAYER_NOT_IN_ROOM_LOCKERS);
            }
            else if (player.GetData(EntityData.PLAYER_ON_DUTY) == 0)
            {
                player.SendChatMessage(Constants.COLOR_ERROR + Messages.ERR_PLAYER_NOT_ON_DUTY);
            }
            else if (player.GetData(EntityData.PLAYER_FACTION) == Constants.FACTION_POLICE)
            {
                switch (action.ToLower())
                {
                case Messages.ARG_BASIC:
                    player.Armor = 100;
                    Weapons.GivePlayerNewWeapon(player, WeaponHash.Flashlight, 0, false);
                    Weapons.GivePlayerNewWeapon(player, WeaponHash.Nightstick, 0, true);
                    Weapons.GivePlayerNewWeapon(player, WeaponHash.StunGun, 0, true);
                    player.SendChatMessage(Constants.COLOR_INFO + Messages.INF_EQUIP_BASIC_RECEIVED);
                    break;

                case Messages.ARG_AMMUNITION:
                    if (player.GetData(EntityData.PLAYER_RANK) > 1)
                    {
                        WeaponHash[] playerWeaps = player.Weapons;
                        foreach (WeaponHash playerWeap in playerWeaps)
                        {
                            string    ammunition = Weapons.GetGunAmmunitionType(playerWeap);
                            int       playerId   = player.GetData(EntityData.PLAYER_SQL_ID);
                            ItemModel bulletItem = Globals.GetPlayerItemModelFromHash(playerId, ammunition);
                            if (bulletItem != null)
                            {
                                switch (playerWeap)
                                {
                                case WeaponHash.CombatPistol:
                                    bulletItem.amount += Constants.STACK_PISTOL_CAPACITY;
                                    break;

                                case WeaponHash.SMG:
                                    bulletItem.amount += Constants.STACK_MACHINEGUN_CAPACITY;
                                    break;

                                case WeaponHash.CarbineRifle:
                                    bulletItem.amount += Constants.STACK_ASSAULTRIFLE_CAPACITY;
                                    break;

                                case WeaponHash.PumpShotgun:
                                    bulletItem.amount += Constants.STACK_SHOTGUN_CAPACITY;
                                    break;

                                case WeaponHash.SniperRifle:
                                    bulletItem.amount += Constants.STACK_SNIPERRIFLE_CAPACITY;
                                    break;
                                }

                                Task.Factory.StartNew(() =>
                                {
                                    // Update the bullet's amount
                                    Database.UpdateItem(bulletItem);
                                });
                            }
                            else
                            {
                                bulletItem                 = new ItemModel();
                                bulletItem.hash            = ammunition;
                                bulletItem.ownerEntity     = Constants.ITEM_ENTITY_PLAYER;
                                bulletItem.ownerIdentifier = playerId;
                                bulletItem.amount          = 30;
                                bulletItem.position        = new Vector3(0.0f, 0.0f, 0.0f);
                                bulletItem.dimension       = 0;

                                Task.Factory.StartNew(() =>
                                {
                                    bulletItem.id = Database.AddNewItem(bulletItem);
                                    Globals.itemList.Add(bulletItem);
                                });
                            }
                        }
                        player.SendChatMessage(Constants.COLOR_INFO + Messages.INF_EQUIP_AMMO_RECEIVED);
                    }
                    else
                    {
                        player.SendChatMessage(Constants.COLOR_ERROR + Messages.ERR_PLAYER_NOT_ENOUGH_POLICE_RANK);
                    }
                    break;

                case Messages.ARG_WEAPON:
                    if (player.GetData(EntityData.PLAYER_RANK) > 1)
                    {
                        WeaponHash selectedWeap = new WeaponHash();
                        switch (type.ToLower())
                        {
                        case Messages.ARG_PISTOL:
                            selectedWeap = WeaponHash.CombatPistol;
                            break;

                        case Messages.ARG_MACHINE_GUN:
                            selectedWeap = WeaponHash.SMG;
                            break;

                        case Messages.ARG_ASSAULT:
                            selectedWeap = WeaponHash.CarbineRifle;
                            break;

                        case Messages.ARG_SNIPER:
                            selectedWeap = WeaponHash.SniperRifle;
                            break;

                        case Messages.ARG_SHOTGUN:
                            selectedWeap = WeaponHash.PumpShotgun;
                            break;

                        default:
                            selectedWeap = 0;
                            player.SendChatMessage(Constants.COLOR_HELP + Messages.GEN_EQUIPMENT_WEAP_COMMAND);
                            break;
                        }

                        if (selectedWeap != 0)
                        {
                            Weapons.GivePlayerNewWeapon(player, selectedWeap, 0, true);
                            player.SendChatMessage(Constants.COLOR_INFO + Messages.INF_EQUIP_WEAP_RECEIVED);
                        }
                    }
                    else
                    {
                        player.SendChatMessage(Constants.COLOR_ERROR + Messages.ERR_PLAYER_NOT_ENOUGH_POLICE_RANK);
                    }
                    break;

                default:
                    player.SendChatMessage(Constants.COLOR_HELP + Messages.GEN_EQUIPMENT_AMMO_COMMAND);
                    break;
                }
            }
        }
Ejemplo n.º 36
0
        public void UpdateInventory()
        {
            // Crafting
            if (currentlyCrafting > 0)
            {
                for (int i = 0; i < Globals.Randomizer.Next(5, 10); i++)
                {
                    SceneManager.GameObjects.Add(new Piece(new Vector2(864, 350), TextureManager.explosion, 90, 1.5f));
                }
            }

            craft.Update();
            currentlyCrafting--;
            if (CanCraft() && currentlyCrafting < 0)
            {
                if (craft.Press())
                {
                    currentlyCrafting = 60;
                    SoundManager.craft.Play();
                }
            }
            if (currentlyCrafting == 0)
            {
                SoundManager.explosion.Play();
                int itemLevel = (int)((Inventory[0, 6].ItemLevel + Inventory[1, 6].ItemLevel + Inventory[2, 6].ItemLevel) / 3 + MathHelper.Lerp(-0.2f, 0.2f, (float)Globals.Randomizer.NextDouble()));
                Inventory[0, 6] = new Item(Globals.Nothing);
                Inventory[1, 6] = new Item(Globals.Nothing);
                Inventory[2, 6] = new Item(Globals.Nothing);
                if (Inventory[3, 6].Type != ItemType.nothing)
                {
                    AddItem(Inventory[3, 6]);
                }
                int random = Globals.Randomizer.Next(0, 3);
                if (random == 0)
                {
                    Inventory[3, 6] = new Weapon(this, Globals.Randomizer.Next(0, Weapon.ListOfMethods().Count()), itemLevel);
                }
                else if (random == 1)
                {
                    Inventory[3, 6] = new Hull(this, Globals.Randomizer.Next(0, Hull.ListOfHullMethods().Count()), itemLevel);
                }
                else if (random == 2)
                {
                    Inventory[3, 6] = new Shield(new Vector2(200, Globals.ScreenSize.Y - 35), 100, 20, 60 + itemLevel * 20 + Globals.Randomizer.Next(-5, 15), Globals.Randomizer.Next(0, Shield.ListOfShieldMethods().Count()), itemLevel);
                }
            }

            for (int i = 0; i < Inventory.GetLength(0); i++)
            {
                for (int j = 0; j < Inventory.GetLength(1); j++)
                {
                    if (Inventory[i, j].Pressed() && Inventory[i, j].Type != ItemType.nothing)
                    {
                        selectedItem = Inventory[i, j];
                        selectedItemArrayPosition = new Point(i, j);
                    }

                    // Right click
                    if (Inventory[i, j].PressedRight() && Inventory[i, j].Type != ItemType.nothing)
                    {
                        Inventory[i, j].UseItem(this, Inventory[i, j]);
                    }
                }
            }

            if (Globals.MState.LeftButton == ButtonState.Released)
            {
                if (selectedItem != null)
                {
                    // Move item in inventory
                    for (int i = 0; i < Inventory.GetLength(0); i++)
                    {
                        for (int j = 0; j < Inventory.GetLength(1); j++)
                        {
                            if (Inventory[i, j].HoverOver())
                            {
                                if ((i == 0 && j == 5) || (selectedItemArrayPosition.X == 0 && selectedItemArrayPosition.Y == 5)) // shield
                                {
                                    if (selectedItem.Type == ItemType.shield && Inventory[i, j].Type == ItemType.shield)
                                    {
                                        SwapItem(new Point(i, j));
                                        break;
                                    }
                                }
                                else if ((i == 1 && j == 5) || (selectedItemArrayPosition.X == 1 && selectedItemArrayPosition.Y == 5)) // hull
                                {
                                    if (selectedItem.Type == ItemType.hull && Inventory[i, j].Type == ItemType.hull)
                                    {
                                        SwapItem(new Point(i, j));
                                        break;
                                    }
                                }
                                else if ((i > 1 && j == 5) || (selectedItemArrayPosition.X > 1 && selectedItemArrayPosition.Y == 5)) // weapons
                                {
                                    if ((((selectedItem.Type == ItemType.weapon || Inventory[i, j].Type == ItemType.weapon) && Inventory[i, j].Type == ItemType.nothing) && (Weapons.Count > 1 || !Weapons.Any(item => item == selectedItem)) || (selectedItem.Type == ItemType.weapon && Inventory[i, j].Type == ItemType.weapon)))
                                    {
                                        int numberOfWeapons = Weapons.Count();
                                        SwapItem(new Point(i, j));
                                        if (numberOfWeapons > Weapons.Count())
                                        {
                                            SelectedWeapon = 0;
                                        }
                                        break;
                                    }
                                }
                                else if (!(i > 2 && j == 6)) // inventory
                                {
                                    SwapItem(new Point(i, j));
                                    break;
                                }
                            }
                        }
                    }
                }

                selectedItem = null;
                selectedItemArrayPosition = new Point(0, 0);

                // remove
                for (int i = Inventory.GetLength(0) - 1; i >= 0; i--)
                {
                    for (int j = Inventory.GetLength(1) - 1; j >= 0; j--)
                    {
                        if (Inventory[i, j].Dead)
                        {
                            Inventory[i, j] = new Item(Item.Nothing, ItemType.nothing, TextureManager.none, "", "");
                        }
                    }
                }
            }
        }
Ejemplo n.º 37
0
    public void LoadData(List <string> heroData)
    {
        int index = 2;

        StringId = heroData[0].Split(' ')[1];

        while (heroData[index] != ".end")
        {
            List <string> data = heroData[index++].Replace("%", "").Replace("\"", "").
                                 Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries).ToList();
            switch (data[0])
            {
            case "rendering:":
                RenderingRankOverride = int.Parse(data[2]);
                break;

            case "commonfx:":
                if (CommonEffects == null)
                {
                    CommonEffects = new CommonEffects(data);
                }
                else
                {
                    CommonEffects.LoadData(data);
                }
                break;

            case "combat_skill:":
                SkillArtInfo skillArt = new SkillArtInfo(data, false);
                SkillArtInfo.Add(skillArt);
                break;

            case "riposte_skill:":
                SkillArtInfo riposteArt = new SkillArtInfo(data, false);
                SkillArtInfo.Add(riposteArt);
                break;

            default:
                Debug.LogError("Unknown art token in hero: " + StringId);
                break;
            }
        }
        index += 2;

        while (heroData[index] != ".end")
        {
            List <string> data = heroData[index++].Replace("%", "").Replace("\"", "").
                                 Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries).ToList();
            switch (data[0])
            {
            case "resistances:":
                Resistanses.Add(AttributeType.Stun, float.Parse(data[2]) / 100);
                Resistanses.Add(AttributeType.Poison, float.Parse(data[4]) / 100);
                Resistanses.Add(AttributeType.Bleed, float.Parse(data[6]) / 100);
                Resistanses.Add(AttributeType.Disease, float.Parse(data[8]) / 100);
                Resistanses.Add(AttributeType.Move, float.Parse(data[10]) / 100);
                Resistanses.Add(AttributeType.Debuff, float.Parse(data[12]) / 100);
                Resistanses.Add(AttributeType.DeathBlow, float.Parse(data[14]) / 100);
                Resistanses.Add(AttributeType.Trap, float.Parse(data[16]) / 100);
                break;

            case "weapon:":
                Equipment weapon = new Equipment(data[2], Weapons.Count + 1, HeroEquipmentSlot.Weapon);
                weapon.EquipmentModifiers.Add(new FlatModifier(AttributeType.DamageLow, float.Parse(data[6]), false));
                weapon.EquipmentModifiers.Add(new FlatModifier(AttributeType.DamageHigh, float.Parse(data[7]), false));
                weapon.EquipmentModifiers.Add(new FlatModifier(AttributeType.CritChance, float.Parse(data[9]) / 100, false));
                weapon.EquipmentModifiers.Add(new FlatModifier(AttributeType.SpeedRating, float.Parse(data[11]), false));
                Weapons.Add(weapon);
                break;

            case "armour:":
                Equipment armor = new Equipment(data[2], Armors.Count + 1, HeroEquipmentSlot.Armor);
                armor.EquipmentModifiers.Add(new FlatModifier(AttributeType.DefenseRating, float.Parse(data[4]) / 100, false));
                armor.EquipmentModifiers.Add(new FlatModifier(AttributeType.HitPoints, float.Parse(data[8]), true));
                Armors.Add(armor);
                break;

            case "combat_skill:":
                List <string> combatData = new List <string>();
                data = heroData[index - 1].Split(new char[] { '\"' }, StringSplitOptions.RemoveEmptyEntries).ToList();
                bool isEffectData = false;
                foreach (var item in data)
                {
                    if (isEffectData)
                    {
                        if (item.Trim(' ').StartsWith("."))
                        {
                            isEffectData = false;
                        }
                        else
                        {
                            combatData.Add(item);
                            continue;
                        }
                    }

                    string[] combatItems = item.Replace("%", "").Split(
                        new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
                    if (combatItems[combatItems.Length - 1] == ".effect")
                    {
                        isEffectData = true;
                    }
                    combatData.AddRange(combatItems);
                }

                CombatSkillVariants.Add(new CombatSkill(combatData, true));
                break;

            case "combat_move_skill:":
                MoveSkill moveSkill = new MoveSkill();
                moveSkill.Id           = data[2];
                moveSkill.Type         = data[6];
                moveSkill.MoveBackward = int.Parse(data[8]);
                moveSkill.MoveForward  = int.Parse(data[9]);
                MoveSkill = moveSkill;
                break;

            case "riposte_skill:":
                List <string> riposteData = new List <string>();
                data = heroData[index - 1].Split(new char[] { '\"' }).ToList();
                bool isReposteEffect = false;
                foreach (var item in data)
                {
                    if (isReposteEffect)
                    {
                        if (item.Trim(' ')[0] == '.')
                        {
                            isEffectData = false;
                        }
                        else
                        {
                            riposteData.Add(item);
                            continue;
                        }
                    }

                    string[] combatItems = item.Replace("%", "").Split(
                        new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
                    if (combatItems[combatItems.Length - 1] == ".effect")
                    {
                        isEffectData = true;
                    }
                    riposteData.AddRange(combatItems);
                }
                RiposteSkill = new CombatSkill(riposteData, true);
                break;

            case "incompatible_party_member:":
                IncompatiablePartyTag = data[4];
                break;

            case "tag:":
                Tags.Add(data[2]);
                break;

            case "controlled:":
                TargetRank = int.Parse(data[2]);
                break;

            case "id_index:":
                IndexId = int.Parse(data[2]);
                break;

            case "skill_selection:":
                CanSelectCombatSkills        = bool.Parse(data[2]);
                NumberOfSelectedCombatSkills = int.Parse(data[4]);
                break;

                #region Death Door
            case "deaths_door:":
                if (DeathDoor == null)
                {
                    DeathDoor = new DeathDoor(data);
                }
                else
                {
                    DeathDoor.LoadData(data);
                }
                break;

                #endregion
                #region Generation
            case "generation:":
                if (Generation == null)
                {
                    Generation = new HeroGeneration(data);
                }
                else
                {
                    Generation.LoadData(data);
                }
                break;

                #endregion
                #region Battle Loot
            case "extra_battle_loot:":
                if (ExtraBattleLoot == null)
                {
                    ExtraBattleLoot = new LootDefinition(data);
                }
                else
                {
                    ExtraBattleLoot.LoadData(data);
                }
                break;

                #endregion
                #region Curio Loot
            case "extra_curio_loot:":
                if (ExtraCurioLoot == null)
                {
                    ExtraCurioLoot = new LootDefinition(data);
                }
                else
                {
                    ExtraCurioLoot.LoadData(data);
                }
                break;

                #endregion
                #region Inventory Stack
            case "extra_stack_limit:":
                ExtraStackLimit = data[2];
                break;

                #endregion
                #region Mode
            case "mode:":
                Modes.Add(new CharacterMode(data));
                break;

                #endregion
            default:
                Debug.LogError("Unknown info token " + data[0] + " in hero: " + StringId);
                break;
            }
        }

        CombatSkills = new List <CombatSkill>(CombatSkillVariants.FindAll(skill => skill.Level == 0));
    }
Ejemplo n.º 38
0
        public override void UpdateLevel(Level level)
        {
            if (!Move)
            {
                // Die
                if (Health.Value <= 0)
                {
                    Move = true;
                    Dead = true;
                    SoundManager.die.Play();
                }

                Position = new Vector2(Position.X, (float)MathHelper.Lerp(Position.Y, Globals.ScreenSize.Y - Texture.Height, 0.1f));
                base.UpdateLevel(level);
                // Select weapon
                for (int i = 0; i < Weapons.Count(); i++)
                {
                    if (Weapons[i].Pressed())
                    {
                        SelectedWeapon = i;
                        SoundManager.swapItem.Play();
                        break;
                    }
                }
                if (Globals.KState.IsKeyDown(Keys.D1) && Globals.PrevKState.IsKeyUp(Keys.D1))
                {
                    SelectedWeapon = 0;
                    SoundManager.swapItem.Play();
                }
                else if (Globals.KState.IsKeyDown(Keys.D2) && Globals.PrevKState.IsKeyUp(Keys.D2) && Weapons.Count >= 2)
                {
                    SelectedWeapon = 1;
                    SoundManager.swapItem.Play();
                }
                else if (Globals.KState.IsKeyDown(Keys.D3) && Globals.PrevKState.IsKeyUp(Keys.D3) && Weapons.Count >= 3)
                {
                    SelectedWeapon = 2;
                    SoundManager.swapItem.Play();
                }

                // Right
                if (MoveRight > 0)
                {
                    MoveRight--;
                    if (Globals.KState.IsKeyDown(Keys.D) && Globals.PrevKState.IsKeyUp(Keys.D) && ShipLocation != Location.right)
                    {
                        DirectionSpeed = 0.0005f;
                        ShipLocation++;
                        MoveRight = 0;
                        if (level.GameObjects.Any(item => item is Enemy))
                        {
                            Enemy enemy = (Enemy)level.GameObjects.First(item => item is Enemy);
                            enemy.ShootTimer = 90;
                            enemy.MoveTimer  = 30;
                        }
                    }
                }

                // Left
                if (MoveLeft > 0)
                {
                    MoveLeft--;
                    if (Globals.KState.IsKeyDown(Keys.A) && Globals.PrevKState.IsKeyUp(Keys.A) && ShipLocation != Location.left)
                    {
                        DirectionSpeed = -0.0005f;
                        ShipLocation--;
                        MoveLeft = 0;
                        if (level.GameObjects.Any(item => item is Enemy))
                        {
                            Enemy enemy = (Enemy)level.GameObjects.First(item => item is Enemy);
                            enemy.ShootTimer = 90;
                            enemy.MoveTimer  = 30;
                        }
                    }
                }
            }
            else
            {
                Animation();
                Direction = MathHelper.Lerp(Direction, (float)Math.PI, 0.03f);
                Speed    += 0.1f;
                Position += new Vector2((float)Math.Cos(Direction) * Speed, (float)Math.Sin(Direction) * Speed);

                if (Dead == true)
                {
                    Speed     -= 0.06f;
                    Direction += MathHelper.Lerp(-0.15f, 0.15f, (float)Globals.Randomizer.NextDouble());
                    for (int i = 0; i < Globals.Randomizer.Next(1, 2); i++)
                    {
                        level.ToAdd.Add(new Piece(new Vector2(Position.X + Globals.Randomizer.Next(-20, 20), Position.Y + Globals.Randomizer.Next(-20, 20)), Texture, 60, 0.5f));
                        level.ToAdd.Add(new Piece(new Vector2(Position.X + Globals.Randomizer.Next(-20, 20), Position.Y + Globals.Randomizer.Next(-20, 20)), TextureManager.explosion, 60, 1.5f));
                    }
                }
            }
        }
Ejemplo n.º 39
0
 // Use this for initialization
 void Start()
 {
     weapons = FindObjectOfType <Weapons>();
 }
Ejemplo n.º 40
0
 public Deity(Qualities qualities, Weapons weapons)
 {
 }
Ejemplo n.º 41
0
 void ShootingControl()
 {
     //Weapon Selection Control
     if (Input.GetKeyDown(KeyCode.Alpha1))
     {
         weapon = Weapons.PISTOL;
         ChangeWeaponText("PISTOL");
     }
     else if (Input.GetKeyDown(KeyCode.Alpha2))
     {
         weapon = Weapons.MACHINEGUN;
         ChangeWeaponText("MACHINEGUN");
     }
     else if (Input.GetKeyDown(KeyCode.Alpha3))
     {
         weapon = Weapons.SHOTGUN;
         ChangeWeaponText("SHOTGUN");
     }
     //Check For ammo
     if (Input.GetMouseButton(0))
     {
         if (weapon == Weapons.PISTOL)
         {
             turret.GetComponent<TurretScript>().ShootWeapon(0);
         }
         if (weaponAmmo[(int)weapon] > 0 && weapon != Weapons.PISTOL)
         {
             turret.GetComponent<TurretScript>().ShootWeapon((int)weapon);
         }
     }
 }
Ejemplo n.º 42
0
        internal void CleanUp()
        {
            AiCloseTick = Session.Tick;

            MyGrid.Components.Remove <AiComponent>();

            for (int i = 0; i < MIds.Length; i++)
            {
                MIds[i] = 0;
            }

            if (Session.IsClient)
            {
                Session.SendUpdateRequest(MyGrid.EntityId, PacketType.ClientAiRemove);
            }

            Data.Repo.ControllingPlayers.Clear();
            Data.Repo.ActiveTerminal = 0;

            CleanSortedTargets();
            Construct.Clean();
            Obstructions.Clear();
            ObstructionsTmp.Clear();
            TargetAis.Clear();
            TargetAisTmp.Clear();
            EntitiesInRange.Clear();
            Batteries.Clear();
            Targets.Clear();
            Weapons.Clear();
            WeaponsIdx.Clear();
            WeaponBase.Clear();
            LiveProjectile.Clear();
            DeadProjectiles.Clear();
            NearByShieldsTmp.Clear();
            NearByFriendlyShields.Clear();
            StaticsInRange.Clear();
            StaticsInRangeTmp.Clear();
            TestShields.Clear();
            NewEntities.Clear();
            SubGridsRegistered.Clear();
            PreviousTargets.Clear();
            SourceCount           = 0;
            BlockCount            = 0;
            AiOwner               = 0;
            ProjectileTicker      = 0;
            NearByEntities        = 0;
            NearByEntitiesTmp     = 0;
            MyProjectiles         = 0;
            AccelChecked          = false;
            PointDefense          = false;
            FadeOut               = false;
            SuppressMouseShoot    = false;
            OverPowered           = false;
            UpdatePowerSources    = false;
            AvailablePowerChanged = false;
            PowerIncrease         = false;
            RequestedPowerChanged = false;
            RequestIncrease       = false;
            DbReady               = false;
            GridInit              = false;
            TouchingWater         = false;
            Data.Clean();

            MyShield         = null;
            MyPlanetTmp      = null;
            MyPlanet         = null;
            TerminalSystem   = null;
            LastTerminal     = null;
            PowerDistributor = null;
            PowerBlock       = null;
            MyGrid           = null;
            PowerDistributor = null;
            Session          = null;
            Closed           = true;
            CanShoot         = true;
            Version++;
        }
Ejemplo n.º 43
0
        private void GeneratePteraBeast()
        {
            BestialArchetype = BestialArchetypes.PteraBeast;

            // Generate base stats
            Stats.WeaponSkill    = 45;
            Stats.BallisticSkill = 0;
            Stats.Strength       = 40;
            Stats.Toughness      = 35;
            Stats.Agility        = 35;
            Stats.Intelligence   = 16;
            Stats.Perception     = 48;
            Stats.WillPower      = 35;
            Stats.Fellowship     = 10;

            BaseMovement = 3;
            Wounds       = 10;

            // Generate Skills
            Skills.AwarenessPer = 1;
            Skills.DodgeAg      = 1;

            // Generate Talents
            int randValue = Globals.Rand.Next(3);

            if (randValue == 0)
            {
                Talents.DoubleTeam++;
            }
            else if (randValue == 1)
            {
                Talents.LightningReflexes++;
            }
            else
            {
                Talents.StepAside++;
            }

            // Generate Traits
            Traits.Bestial++;
            Traits.Flyer = 6;
            Traits.NaturalWeapons++;

            // Generate Weapons (Note that weapon damage bonus is NOT including strength)
            Weapons.Add(new Weapon("Cruel talons, barbed tail, or vicious beak", true, 1, 0, "I or R", 0, true));

            // Generate Bestial Nature
            randValue = Globals.RollD10();
            if (randValue <= 1)
            {
                BestialNature    = new DocContentItem("Aerial Impossibility", 36);
                Traits.Size      = Globals.RollD10() > 5 ? XenosSizes.Enormous : XenosSizes.Massive;
                Stats.Strength  += 15 + Globals.RollD10();
                Stats.Toughness += 15 + Globals.RollD10();
                Wounds          += Globals.Rand.Next(8, 15);
                if (Globals.RollD10() > 6)
                {
                    Traits.NaturalArmour = Globals.Rand.Next(1, 6);
                }
            }
            else if (randValue <= 3)
            {
                BestialNature = new DocContentItem("Doom Diver", 36);
                // Special attack only, listed in book
            }
            else if (randValue <= 5)
            {
                BestialNature = new DocContentItem("Earth-Scorning", 36);
                EarthScorning = true;
                // Special features only, listed in book
            }
            else if (randValue <= 6)
            {
                BestialNature = new DocContentItem("Skyless Flight", 36);
                // Special features only, listed in book
            }
            else if (randValue <= 9)
            {
                BestialNature  = new DocContentItem("Swift Flyer", 36);
                Stats.Agility += 10;
                Traits.Flyer   = 12;
            }
            else
            {
                BestialNature = new DocContentItem("Wyrdwing", 36);
                // Special features only, listed in book
            }
        }
Ejemplo n.º 44
0
    //Calculate the weapon triangle effects
    int[] WeaponTriangleEffect(Weapons AttackerWeapon, Weapons DefenderWeapon)
    {
        Weapons.WeaponType dType = DefenderWeapon.WeaponCategory;

        int DamageModifier = 0, HitModifier = 0;
        int Advantage = 0;  //since bools can't be null: -1 = Disadvantage, 0 = neutral, +1 Advantage

        //Switch based on the attackers weapon type
        switch (AttackerWeapon.WeaponCategory)
        {
        //Then switch on defender's weapon type. Grant an advantage/disadvantage as appropriate
        case Weapons.WeaponType.Sword:
            if (dType == Weapons.WeaponType.Axe)
            {
                DamageModifier = 1; HitModifier = 15; Advantage = 1;
            }
            else if (dType == Weapons.WeaponType.Lance)
            {
                DamageModifier = -1; HitModifier = -15; Advantage = -1;
            }
            break;

        case Weapons.WeaponType.Lance:
            if (dType == Weapons.WeaponType.Sword)
            {
                DamageModifier = 1; HitModifier = 15; Advantage = 1;
            }
            else if (dType == Weapons.WeaponType.Axe)
            {
                DamageModifier = -1; HitModifier = -15; Advantage = -1;
            }
            break;

        case Weapons.WeaponType.Axe:
            if (dType == Weapons.WeaponType.Lance)
            {
                DamageModifier = 1; HitModifier = 15; Advantage = 1;
            }
            else if (dType == Weapons.WeaponType.Sword)
            {
                DamageModifier = -1; HitModifier = -15; Advantage = -1;
            }
            break;

        case Weapons.WeaponType.Arcane:
            if (dType == Weapons.WeaponType.Divine)
            {
                DamageModifier = 1; HitModifier = 15; Advantage = 1;
            }
            else if (dType == Weapons.WeaponType.Occult)
            {
                DamageModifier = -1; HitModifier = -15; Advantage = -1;
            }
            break;

        case Weapons.WeaponType.Divine:
            if (dType == Weapons.WeaponType.Occult)
            {
                DamageModifier = 1; HitModifier = 15; Advantage = 1;
            }
            else if (dType == Weapons.WeaponType.Arcane)
            {
                DamageModifier = -1; HitModifier = -15; Advantage = -1;
            }
            break;

        case Weapons.WeaponType.Occult:
            if (dType == Weapons.WeaponType.Arcane)
            {
                DamageModifier = 1; HitModifier = 15; Advantage = 1;
            }
            else if (dType == Weapons.WeaponType.Divine)
            {
                DamageModifier = -1; HitModifier = -15; Advantage = -1;
            }
            break;
        }

        return(new int[3] {
            DamageModifier, HitModifier, Advantage
        });
    }
Ejemplo n.º 45
0
    void Initialize(Archetype arch, Weapons wep)
    {
        //sets up player based on chosen class
        initialized = true;
        equippedWeapon = wep;
        playerArchetype = arch;

        switch (playerArchetype) {

        case Archetype.VIN :
            name = "Vin Tekiel";
            className = "The Street Urchin";

            mHealth = 85f; //baseline 100
            mStamina = 100f; //baseline 100

            weight = 50f; //baseline 75
            skill = 100f; //baseline 100
            strength = 70f;
            ability = 90f;
            break;

        case Archetype.VIN2 :
            name = "Vin Venture";
            className = "The Shard of Preservation";

            mHealth = 50f; //baseline 100
            mStamina = 150f; //baseline 100

            weight = 60f; //baseline 75
            skill = 110f; //baseline 100
            strength = 80f;
            ability = 120f;

            break;
        case Archetype.KELSIER :
            name = "Kelsier";
            className = "The Survivor of Hathsin";

            mHealth = 110f; //baseline 100
            mStamina = 75f; //baseline 100

            weight = 75f; //baseline 75
            skill = 110f; //baseline 100
            strength = 100f;
            ability = 100f;
            break;

        case Archetype.WAX :
            break;
        case Archetype.INQUISITOR :
            name = "Steel Inquisitor";
            className = "The Harbinger of Ruin";

            mHealth = 150f; //baseline 100
            mStamina = 50f; //baseline 100

            weight = 100f; //baseline 75
            skill = 65f; //baseline 100
            strength = 110f;
            ability = 100f;
            break;

        }
        switch (equippedWeapon)
        {
        case Weapons.DAGGERS:
            weaponName = "Obsidian Daggers";
            range = 1f;
            attackSpeed = 4.5f;
            baseDamage = 5f;
            critChance = 2f;
            bleedChance = 5f;
            minRange = 0f;
            break;
        case Weapons.CANE:
            weaponName = "Dueling Cane";
            range = 2f;
            attackSpeed = 2.75f;
            baseDamage = 7.5f;
            critChance = 2f;
            bleedChance = 1f;
            minRange = 0f;
            break;
        case Weapons.SPEAR:
            weaponName = "Obsidian Spear";
            range = 3f;
            attackSpeed = 2.25f;
            baseDamage = 10f;
            critChance = 3.5f;
            bleedChance = 5f;
            minRange = 1f;
            break;
        case Weapons.VINDICATION:
            weaponName = "Vindication Revolver";
            range = 10f;
            attackSpeed = 1.5f;
            baseDamage = 20f;
            critChance = 10f;
            bleedChance = 75f;
            minRange = 2f;
            break;
        case Weapons.STERRION:
            weaponName = "Sterrion Revolvers";
            range = 6.5f;
            attackSpeed = 2f;
            baseDamage = 10f;
            critChance = 2.5f;
            bleedChance = 5f;
            minRange = 1f;
            break;

        }
        health = mHealth;
        stamina = mStamina;
        initialized = true;
        Debug.Log (className + " is initialized!");
    }
Ejemplo n.º 46
0
 public bool CanTarget(ITargetable target)
 {
     // TODO - alliances
     return(target.Owner != Owner && Weapons.Any(c => !c.IsDestroyed && c.Template.ComponentTemplate.WeaponInfo.Targets.HasFlag(target.WeaponTargetType)));
 }
Ejemplo n.º 47
0
 /** setWeapon is a setter method responsible for setting the Weapons obj
  * @param myWeapon the weapon to be used
  */
 public void setWeapon(Weapons myWeapon)
 {
     this.myWeapon = myWeapon;
 }
Ejemplo n.º 48
0
 public static void LoadData()
 {
     AllWeapons = Resources.Load <Weapons>(Path);
 }
Ejemplo n.º 49
0
 public Weapon(int x, int y, int width, int height, Rarities rarity, Weapons weaponType, double attackPoints)
     : base(x, y, width, height, rarity)
 {
     this.WeaponType = weaponType;
     this.AttackPoints = attackPoints;
 }
Ejemplo n.º 50
0
    private void Update()
    {
        currentWeapon = weaponManager.GetCurrentWeapon();

        if (currentWeapon == null)
        {
            return;
        }

        if (PauseMenu.isOn)
        {
            return;
        }

        if (isLocalPlayer)
        {
            //Weapon switching keycodes
            if (Input.GetKeyDown(KeyCode.Alpha1))
            {
                weaponManager.CmdSwitchWeapon(1);
                return;
            }
            if (Input.GetKeyDown(KeyCode.Alpha2))
            {
                weaponManager.CmdSwitchWeapon(2);
                return;
            }
            if (Input.GetKeyDown(KeyCode.Alpha3))
            {
                weaponManager.CmdSwitchWeapon(3);
                return;
            }
            if (Input.GetKeyDown(KeyCode.Alpha4))
            {
                weaponManager.CmdSwitchWeapon(4);
                return;
            }
        }

        //Only allows reloading if the clip is not full
        if (currentWeapon.bullets < currentWeapon.maxBullets && Input.GetButton("Reload"))
        {
            weaponManager.Reload();
            return;
        }

        if (weaponManager.currentWeaponIndex == 3)
        {
            if (Input.GetButtonDown("Fire2"))
            {
                defaultFOV = mainCamera.fieldOfView;
                weaponCamera.SetActive(false);
                mainCamera.fieldOfView = zoomedInFOV;
            }
            if (Input.GetButtonUp("Fire2"))
            {
                weaponCamera.SetActive(true);
                mainCamera.fieldOfView = defaultFOV;
            }
        }

        //If a weapon has a fire rate of 0f then it is not automatic and requires
        //a button press for every shot made
        if (currentWeapon.fireRate <= 0f)
        {
            //Checking if enough time has passed since the last shot made by
            //manual weapons
            if (Input.GetButtonDown("Fire1") && (Time.time - lastShotTime) > currentWeapon.manualShootingFireRate)
            {
                Shoot();
            }
        }
        else
        {
            if (Input.GetButtonDown("Fire1"))
            {
                //Automatic weapons are shooting as long as the fire button is pressed
                InvokeRepeating("Shoot", 0f, currentWeapon.fireRate);
            }
            else if (Input.GetButtonUp("Fire1"))
            {
                CancelInvoke("Shoot");
            }
        }
    }
Ejemplo n.º 51
0
        /// <summary>
        /// Manages joypadControls
        /// </summary>
        /// <param name="Gamepad"></param>
        public void JoyPadControls(GamePadState Gamepad)
        {
            runSpeed = Gamepad.ThumbSticks.Left.Y * 10;
            sprintspeed = runSpeed * 2;
            strafeSpeed = Gamepad.ThumbSticks.Left.X * 8;

            if (Gamepad.ThumbSticks.Right.X != 0.0f)
            {
                eyes.cYaw -= eyes.cRotation * (Gamepad.ThumbSticks.Right.X * 1.5f);
                eyes.updateRotation();
            }
            if (Gamepad.ThumbSticks.Right.Y != 0.0f)
            {
                eyes.cUpRot += eyes.cRotation * (Gamepad.ThumbSticks.Right.Y * 1.5f);
                eyes.updateRotation();
            }

            if (Gamepad.Buttons.Y == ButtonState.Pressed)
            {
                if (currentlyEquipped == Weapons.bullet)
                {
                    for (int i = 0; i < bulletlist.Length; i++)
                    {
                        bulletlist[i].Destroy(base.Position);
                    }
                }

                if (currentlyEquipped == Weapons.LongRange)
                {
                    LongRange.Destroy(base.Position);
                }

                if (currentlyEquipped == Weapons.shortRange)
                {
                    shortRange.Destroy(base.Position);
                }
            }

            if (Gamepad.Buttons.A == ButtonState.Pressed && available > Weapons.none)
            {
                currentlyEquipped = Weapons.shortRange;
            }
            if (Gamepad.Buttons.B == ButtonState.Pressed && available > Weapons.shortRange)
            {
                currentlyEquipped = Weapons.bullet;
            }
            if (Gamepad.Buttons.X == ButtonState.Pressed && available > Weapons.bullet)
            {
                currentlyEquipped = Weapons.LongRange;
            }
            if (Gamepad.Buttons.X == ButtonState.Pressed)
            {
                base.charAcceleration += new Vector3(0.0f, 10.0f, 0.0f);
            }

            if (Gamepad.ThumbSticks.Left.Y != 0.0f) // Forward
            {

                if (Gamepad.Buttons.LeftStick == ButtonState.Pressed)
                {
                    eyes.Move(new Vector3(0, 0, -(sprintspeed)));
                }
                else
                {
                    eyes.Move(new Vector3(0, 0, -(runSpeed)));
                }
            }

            if (Gamepad.ThumbSticks.Left.X != 0.0f) // Left
            {
                eyes.Move(new Vector3((strafeSpeed), 0, 0));
            }

            if (Gamepad.Triggers.Right > 0.0f) //Shoot
            {
                if (currentlyEquipped == Weapons.bullet)
                {
                    for (int i = 0; i < bulletlist.Length; i++)
                    {

                        if (bulletlist[i].Active == false)
                        {
                            bulletlist[i].Shoot(eyes.cRotationMatrix.Forward);
                            break;
                        }
                    }
                }
                if (currentlyEquipped == Weapons.LongRange)
                {
                    if (LongRange.Active == false)
                    {
                        LongRange.Shoot(eyes.cRotationMatrix.Forward);
                    }
                }
                if (currentlyEquipped == Weapons.shortRange)
                {
                    if (shortRange.Active == false)
                    {
                        shortRange.Shoot(eyes.cRotationMatrix.Forward);
                    }
                }

            }
        }
Ejemplo n.º 52
0
        public UnitCalculation(Unit unit, int repairers, SharkyUnitData sharkyUnitData, SharkyOptions sharkyOptions, UnitDataService unitDataService, int frame)
        {
            TargetPriorityCalculation = new TargetPriorityCalculation();
            oneSecondInFrames         = sharkyOptions.FramesPerSecond;

            //PreviousUnits = new Dictionary<int, Unit>();
            //PreviousUnits[frame] = unit;
            PreviousUnit = unit;
            Unit         = unit;
            UnitTypeData = sharkyUnitData.UnitData[(UnitTypes)unit.UnitType];

            Velocity        = 0;
            AverageVelocity = 0;
            Vector          = Vector2.Zero;
            AverageVector   = Vector2.Zero;
            Position        = new Vector2(unit.Pos.X, unit.Pos.Y);

            FrameLastSeen = frame;

            var unitRange = unitDataService.GetRange(unit);

            if (unitRange == 0)
            {
                Range = 0;
            }
            else
            {
                Range = unitRange + unit.Radius;
            }

            Start = new Vector2(unit.Pos.X, unit.Pos.Y);

            if (unit.UnitType == (uint)UnitTypes.PROTOSS_COLOSSUS || unit.UnitType == (uint)UnitTypes.PROTOSS_IMMORTAL || unit.UnitType == (uint)UnitTypes.PROTOSS_PHOTONCANNON || unit.UnitType == (uint)UnitTypes.PROTOSS_MOTHERSHIP ||
                unit.UnitType == (uint)UnitTypes.TERRAN_MISSILETURRET ||
                unit.UnitType == (uint)UnitTypes.ZERG_SPORECRAWLER || unit.UnitType == (uint)UnitTypes.ZERG_SPINECRAWLER)
            {
                End = Start; // facing is always 0 for these units, can't calculate where they're aiming
            }
            else
            {
                var endX = (float)(Range * Math.Sin(unit.Facing + (Math.PI / 2)));
                var endY = (float)(Range * Math.Cos(unit.Facing + (Math.PI / 2)));
                End = new Vector2(endX + unit.Pos.X, unit.Pos.Y - endY);
            }

            DamageRadius      = 1; // TODO: get damage radius
            EstimatedCooldown = 0; // TODO: get estimated cooldown

            DamageAir = false;
            if (unitDataService.CanAttackAir((UnitTypes)unit.UnitType))
            {
                DamageAir = true;
            }
            DamageGround = false;
            if (unitDataService.CanAttackGround((UnitTypes)unit.UnitType))
            {
                DamageGround = true;
            }
            Damage  = unitDataService.GetDamage(unit);
            Dps     = unitDataService.GetDps(unit);
            Weapon  = unitDataService.GetWeapon(unit);
            Weapons = UnitTypeData.Weapons.ToList();
            if (Weapons == null || Weapons.Count() == 0)
            {
                Weapons = new List <Weapon>();
                if (Weapon != null)
                {
                    Weapons.Add(Weapon);
                }
            }

            SimulatedHitpoints = Unit.Health + Unit.Shield;
            if (Unit.BuffIds.Contains((uint)Buffs.IMMORTALOVERLOAD))
            {
                SimulatedHitpoints += 100;
            }
            if (unit.UnitType == (uint)UnitTypes.PROTOSS_WARPPRISM)
            {
                SimulatedHitpoints += 500;
            }

            if (sharkyUnitData.ZergTypes.Contains((UnitTypes)Unit.UnitType))
            {
                SimulatedHealPerSecond = 0.38f;
            }
            else if (repairers > 0 && UnitTypeData.Attributes.Contains(SC2APIProtocol.Attribute.Mechanical))
            {
                SimulatedHealPerSecond = (float)(unit.HealthMax / (UnitTypeData.BuildTime / sharkyOptions.FramesPerSecond)) * repairers;
            }
            else if (Unit.UnitType == (uint)UnitTypes.TERRAN_MEDIVAC && Unit.Energy > 10)
            {
                SimulatedHealPerSecond = 12.6f;
            }
            else if (Unit.UnitType == (uint)UnitTypes.ZERG_QUEEN && Unit.Energy >= 50)
            {
                SimulatedHealPerSecond = 20;
            }
            else
            {
                SimulatedHealPerSecond = 0;
            }

            if (Unit.UnitType == (uint)UnitTypes.TERRAN_BUNKER && Unit.BuildProgress == 1) // assume 4 marines
            {
                Range        = 6;
                DamageAir    = true;
                DamageGround = true;
                Damage       = 6;
                Dps          = Damage * 4 / 0.61f;
            }

            Attributes = UnitTypeData.Attributes;

            UnitClassifications = new List <UnitClassification>();
            if (UnitTypeData.Attributes.Contains(SC2APIProtocol.Attribute.Structure))
            {
                if (sharkyUnitData.ResourceCenterTypes.Contains((UnitTypes)unit.UnitType))
                {
                    UnitClassifications.Add(UnitClassification.ResourceCenter);
                    UnitClassifications.Add(UnitClassification.ProductionStructure);
                }
                if (sharkyUnitData.DefensiveStructureTypes.Contains((UnitTypes)unit.UnitType))
                {
                    UnitClassifications.Add(UnitClassification.DefensiveStructure);
                }
            }
            else if (unit.UnitType == (uint)UnitTypes.TERRAN_SCV || unit.UnitType == (uint)UnitTypes.PROTOSS_PROBE || unit.UnitType == (uint)UnitTypes.ZERG_DRONE)
            {
                UnitClassifications.Add(UnitClassification.Worker);
            }
            else if (unit.UnitType == (uint)UnitTypes.ZERG_QUEEN || unit.UnitType == (uint)UnitTypes.TERRAN_MULE || unit.UnitType == (uint)UnitTypes.ZERG_OVERLORD || unit.UnitType == (uint)UnitTypes.ZERG_LARVA || unit.UnitType == (uint)UnitTypes.ZERG_EGG)
            {
            }
            else
            {
                UnitClassifications.Add(UnitClassification.ArmyUnit);
            }

            if (sharkyUnitData.DetectionTypes.Contains((UnitTypes)unit.UnitType))
            {
                UnitClassifications.Add(UnitClassification.Detector);
            }
            if (sharkyUnitData.AbilityDetectionTypes.Contains((UnitTypes)unit.UnitType))
            {
                UnitClassifications.Add(UnitClassification.DetectionCaster);
            }
            if (sharkyUnitData.CloakableAttackers.Contains((UnitTypes)unit.UnitType))
            {
                UnitClassifications.Add(UnitClassification.Cloakable);
            }

            EnemiesInRange   = new List <UnitCalculation>();
            EnemiesInRangeOf = new List <UnitCalculation>();
            NearbyAllies     = new List <UnitCalculation>();
            NearbyEnemies    = new List <UnitCalculation>();
            Attackers        = new List <UnitCalculation>();
            IncomingDamage   = 0;
        }
Ejemplo n.º 53
0
        /// <summary>
        /// Used to manage Keyboard Input and Mouse Input
        /// </summary>
        /// <param name="keyboardState"></param>
        /// <param name="mouseState"></param>
        public void Controls(KeyboardState keyboardState, MouseState mouseState)
        {
            if (keyboardState.IsKeyDown(Keys.Space))
            {
                for(int i = 0; i < bulletlist.Length; i++)
                {
                       {
                            bulletlist[i].Shoot(eyes.cRotationMatrix.Forward);
                         }
                }
                    if (currentlyEquipped == Weapons.LongRange)
                    {
                        if (LongRange.Active == false)
                        {
                            LongRange.Shoot(eyes.cRotationMatrix.Forward);

                        }
                    }
                    if (currentlyEquipped == Weapons.shortRange)
                    {
                        if (shortRange.Active == false)
                        {
                            shortRange.Shoot(eyes.cRotationMatrix.Forward);
                        }
                    }
                }

            if (mouseState.LeftButton == ButtonState.Pressed) // Shoot currently Equipped Weapon if it is active
            {
                if (currentlyEquipped == Weapons.bullet)
                {
                    for (int i = 0; i < bulletlist.Length; i++)
                     {
                        if (bulletlist[i].Active == false)
                        {
                            bulletlist[i].Shoot(eyes.cRotationMatrix.Forward);
                            break;
                        }
                    }
                }
                    if (currentlyEquipped == Weapons.LongRange)
                    {
                        if (LongRange.Active == false)
                        {
                            LongRange.Shoot(eyes.cRotationMatrix.Forward);

                        }
                    }
                    if (currentlyEquipped == Weapons.shortRange)
                    {
                        if (shortRange.Active == false)
                        {
                            shortRange.Shoot(eyes.cRotationMatrix.Forward);
                        }
                    }
                }

            //Equip Weapon if available
            if (keyboardState.IsKeyDown(Keys.D1) && available > Weapons.none )
            {
                currentlyEquipped = Weapons.shortRange;
            }
            if (keyboardState.IsKeyDown(Keys.D2) && available > Weapons.shortRange)
            {
                available = Weapons.bullet;
                currentlyEquipped = Weapons.bullet;
            }
            if (keyboardState.IsKeyDown(Keys.D3) && available > Weapons.bullet)
            {
                currentlyEquipped = Weapons.LongRange;
            }

            //Reload Equipped Weapon
            if (keyboardState.IsKeyDown(Keys.R))
            {
                if (currentlyEquipped == Weapons.bullet)
                {
                    for (int i = 0; i < bulletlist.Length; i++)
                    {
                        bulletlist[i].Destroy(base.Position);
                    }
                }

                if (currentlyEquipped == Weapons.LongRange)
                {
                    LongRange.Destroy(base.Position);
                }

                if (currentlyEquipped == Weapons.shortRange)
                {
                    shortRange.Destroy(base.Position);
                }
            }
        }
Ejemplo n.º 54
0
    public static void PathRenderAttack(PlayerMachine.Data data, Weapons weapons)
    {
        switch (data.slotIndex)
        {
        case 0:
            RenderNone(data);
            break;

        case 1:
            switch (weapons.w1.missileFlight)
            {
            case MissileFlight.curve:
                RenderCurve(data, weapons.w1.range);
                break;

            case MissileFlight.none:
                RenderNone(data);
                break;

            case MissileFlight.simply:
                RenderSimple(data);
                break;
            }
            break;

        case 2:
            switch (weapons.w2.missileFlight)
            {
            case MissileFlight.curve:
                RenderCurve(data, weapons.w2.range);
                break;

            case MissileFlight.none:
                RenderNone(data);
                break;

            case MissileFlight.simply:
                RenderSimple(data);
                break;
            }
            break;

        case 3:
            switch (weapons.w1.missileFlight)
            {
            case MissileFlight.curve:
                RenderCurve(data, weapons.w1.range);
                break;

            case MissileFlight.none:
                RenderNone(data);
                break;

            case MissileFlight.simply:
                RenderSimple(data);
                break;
            }
            break;
        }
        if (data.points < data.cost)
        {
            data.lineRender[0].enabled = false;
        }
        else
        {
            data.lineRender[0].enabled = true;
        }
    }
Ejemplo n.º 55
0
 private void InitShip()
 {
     shipsHull = new Hull();
     shipsWeapons = new Weapons(rand);
     shipShields = new Shield();
 }
Ejemplo n.º 56
0
        private void GenerateApexPredator()
        {
            BestialArchetype = BestialArchetypes.ApexPredator;

            // Generate base stats
            Stats.WeaponSkill    = 58;
            Stats.BallisticSkill = 0;
            Stats.Strength       = 48;
            Stats.Toughness      = 45;
            Stats.Agility        = 48;
            Stats.Intelligence   = 19;
            Stats.Perception     = 49;
            Stats.WillPower      = 41;
            Stats.Fellowship     = 9;

            BaseMovement = 4;
            Wounds       = 15;

            // Generate Skills
            Skills.AwarenessPer = 1;
            Skills.TrackingInt  = 2;

            // Generate Talents
            int randValue = Globals.Rand.Next(4);

            if (randValue == 0)
            {
                Talents.CrushingBlow++;
            }
            else if (randValue == 1)
            {
                Talents.Frenzy++;
            }
            else if (randValue == 2)
            {
                Talents.SwiftAttack++;
            }
            else
            {
                Talents.TalentedTracking++;
            }

            // Generate Traits
            Traits.Bestial++;

            randValue = Globals.Rand.Next(3);
            if (randValue == 0)
            {
                Traits.BrutalCharge++;
            }
            else if (randValue == 1)
            {
                Traits.Fear++;
            }
            else
            {
                Traits.Toxic++;
            }

            Traits.NaturalArmour = 2;
            Traits.NaturalWeapons++;

            // Generate Weapons (Note that weapon damage bonus is NOT including strength)
            Weapons.Add(new Weapon("Claws, fangs, horns, stingers, tentacles, or other deadly adaption", true, 1, 0, "I or R", 0, true));

            // Generate Bestial Nature
            randValue = Globals.RollD10();
            if (randValue <= 2)
            {
                BestialNature = new DocContentItem("Adapted", 35);
                int numExtras = Globals.Rand.Next(3) + 1;
                while (numExtras > 0)
                {
                    switch (Globals.Rand.Next(7))
                    {
                    case 0:
                        if (Talents.CrushingBlow > 0)
                        {
                            continue;
                        }
                        Talents.CrushingBlow++;
                        break;

                    case 1:
                        if (Talents.Frenzy > 0)
                        {
                            continue;
                        }
                        Talents.Frenzy++;
                        break;

                    case 2:
                        if (Talents.SwiftAttack > 0)
                        {
                            continue;
                        }
                        Talents.SwiftAttack++;
                        break;

                    case 3:
                        if (Talents.TalentedTracking > 0)
                        {
                            continue;
                        }
                        Talents.TalentedTracking++;
                        break;

                    case 4:
                        if (Traits.BrutalCharge > 0)
                        {
                            continue;
                        }
                        Traits.BrutalCharge++;
                        break;

                    case 5:
                        if (Traits.Fear > 0)
                        {
                            continue;
                        }
                        Traits.Fear++;
                        break;

                    case 6:
                        if (Traits.Toxic > 0)
                        {
                            continue;
                        }
                        Traits.Toxic++;
                        break;
                    }
                    numExtras--;
                }
            }
            else if (randValue <= 4)
            {
                BestialNature    = new DocContentItem("Brute", 35);
                Traits.Size      = Globals.RollD5() > 5 ? XenosSizes.Hulking : XenosSizes.Enormous;
                Stats.Strength  += Globals.RollD10();
                Stats.Toughness += Globals.RollD10();
                Wounds          += Globals.Rand.Next(3, 7);
                if (Globals.RollD10() > 5)
                {
                    Stats.Agility -= 15;
                }
            }
            else if (randValue <= 6)
            {
                BestialNature = new DocContentItem("Cunning Stalker", 35);
                Skills.ConcealmentAg++;
                Skills.ShadowingAg++;
                Skills.SilentMoveAg++;
            }
            else if (randValue <= 7)
            {
                BestialNature = new DocContentItem("Killing Machine", 35);
                int numTraits = Globals.Rand.Next(3) + 1;
                while (numTraits > 0)
                {
                    switch (Globals.Rand.Next(3))
                    {
                    case 0:
                        if (Traits.UnnaturalSpeed > 0)
                        {
                            continue;
                        }
                        Traits.UnnaturalSpeed++;
                        break;

                    case 1:
                        if (Traits.UnnaturalStrength > 0)
                        {
                            continue;
                        }
                        Traits.UnnaturalStrength++;
                        break;

                    case 2:
                        if (Traits.UnnaturalToughness > 0)
                        {
                            continue;
                        }
                        Traits.UnnaturalToughness++;
                        break;
                    }
                    numTraits--;
                }
                if (Globals.RollD10() > 5)
                {
                    Talents.Fearless++;
                }
                else
                {
                    Talents.ResistanceFear++;
                }
            }
            else if (randValue <= 8)
            {
                BestialNature = new DocContentItem("Living Arsenal", 35);
                foreach (Weapon weapon in Weapons)
                {
                    weapon.Primitive    = false;
                    weapon.Penetration += 2;
                }
                Traits.NaturalArmour = 8;
            }
            else
            {
                BestialNature    = new DocContentItem("Natural Prowess", 35);
                Stats.Strength  += Globals.Rand.Next(16);
                Stats.Toughness += Globals.Rand.Next(16);
                Stats.Agility   += Globals.Rand.Next(16);
            }
        }
Ejemplo n.º 57
0
        public static Weapon GetWeaponFromID(int id)
        {
            switch (id)
            {
            case -1:
                return(Weapons.CreateMaverick());

            case 0:
                return(Weapons.CreateSword());

            case 1:
                return(Weapons.CreateBroadsword());

            case 2:
                return(Weapons.CreateBow());

            case 3:
                return(Weapons.CreateIceBow());

            case 4:
                return(Weapons.CreateThrowingAxe());

            case 5:
                return(Weapons.CreateDwarvenAxe());

            case 6:
                return(Weapons.CreateMaul());

            case 7:
                return(Weapons.CreateHammer());

            case 8:
                return(Weapons.CreateSpear());

            case 9:
                return(Weapons.CreateThrowingSpear());

            case 10:
                return(Weapons.CreateJungleSpear());

            case 11:
                return(Weapons.CreateThrowingDagger());

            case 12:
                return(Weapons.CreateFireball());

            case 13:
                return(Weapons.CreateFirebolt());

            case 14:
                return(Weapons.CreateFirework());

            case 15:
                return(Weapons.CreateHelsingor());

            case 16:
                return(Weapons.CreateBoteng());

            case 17:
                return(Weapons.CreateHira());

            case 18:
                return(Weapons.CreateTaago());

            case 19:
                return(Weapons.CreatePlasmaBolt());

            case 20:
                return(Weapons.CreateGrapple());

            default:
                return(Weapons.CreateSword());
            }
        }
Ejemplo n.º 58
0
        private void GenerateVenomousTerror()
        {
            BestialArchetype = BestialArchetypes.VenomousTerror;

            // Generate base stats
            Stats.WeaponSkill    = 38;
            Stats.BallisticSkill = 0;
            Stats.Strength       = 32;
            Stats.Toughness      = 29;
            Stats.Agility        = 38;
            Stats.Intelligence   = 13;
            Stats.Perception     = 28;
            Stats.WillPower      = 30;
            Stats.Fellowship     = 9;

            BaseMovement = 2;
            Wounds       = 6;

            // Generate Skills
            Skills.AwarenessPer = 1;

            // Generate Talents
            int randValue = Globals.Rand.Next(2);

            if (randValue == 0)
            {
                Talents.Fearless++;
            }
            else
            {
                Talents.Unremarkable++;
            }

            // Generate Traits
            Traits.Bestial++;
            Traits.NaturalWeapons++;
            Traits.Size = XenosSizes.Scrawny;
            Traits.Toxic++;

            // Generate Weapons (Note that weapon damage bonus is NOT including strength)
            Weapon weapon = new Weapon("Envenomed bite or sting", true, 1, 0, "I or R", 6, true)
            {
                Toxic = true
            };

            Weapons.Add(weapon);

            // Generate Bestial Nature
            randValue = Globals.RollD10();
            if (randValue <= 1)
            {
                BestialNature = new DocContentItem("Deadly Touch", 38);
                // Special features only, listed in book
            }
            else if (randValue <= 2)
            {
                BestialNature = new DocContentItem("Delirium Bringer", 38);
                // Special features only, listed in book
            }
            else if (randValue <= 4)
            {
                BestialNature        = new DocContentItem("Toxic Hunter", 38);
                Traits.Size          = XenosSizes.Average;
                Stats.WeaponSkill    = 58;
                Stats.BallisticSkill = 0;
                Stats.Strength       = 48;
                Stats.Toughness      = 45;
                Stats.Agility        = 48;
                Stats.Intelligence   = 19;
                Stats.Perception     = 49;
                Stats.WillPower      = 41;
                Stats.Fellowship     = 9;
                Wounds = 15;
            }
            else if (randValue <= 6)
            {
                BestialNature   = new DocContentItem("Hidden Death", 38);
                Traits.Size     = XenosSizes.Miniscule;
                Stats.Strength  = 11;
                Stats.Toughness = 11;
                Wounds          = 3;
            }
            else if (randValue <= 8)
            {
                BestialNature = new DocContentItem("Poisonous Presence", 38);
                foreach (Weapon weapon1 in Weapons)
                {
                    weapon1.Toxic = false;
                }
            }
            else
            {
                BestialNature = new DocContentItem("Potent Toxins", 38);
                // Special features only, listed in book
            }
        }
Ejemplo n.º 59
0
        internal void CompChange(bool add, WeaponComponent comp)
        {
            if (add)
            {
                if (WeaponsIdx.ContainsKey(comp))
                {
                    Log.Line($"CompAddFailed:<{comp.MyCube.EntityId}> - comp({comp.MyCube.DebugName}[{comp.MyCube.BlockDefinition.Id.SubtypeName}]) already existed in {MyGrid.DebugName}");
                    return;
                }

                if (comp.HasArmor)
                {
                    for (int i = 0; i < comp.Platform.Weapons.Length; i++)
                    {
                        var w = comp.Platform.Weapons[i];
                        if (w.System.Armor != WeaponDefinition.HardPointDef.HardwareDef.ArmorState.IsWeapon)
                        {
                            Armor.Add(w.Comp.MyCube, w);
                        }
                    }
                    Session.ArmorCubes.Add(comp.MyCube, comp);
                }
                WeaponsIdx.Add(comp, Weapons.Count);
                Weapons.Add(comp);
            }
            else
            {
                int idx;
                if (!WeaponsIdx.TryGetValue(comp, out idx))
                {
                    Log.Line($"CompRemoveFailed: <{comp.MyCube.EntityId}> - {Weapons.Count}[{WeaponsIdx.Count}]({WeaponBase.Count}) - {Weapons.Contains(comp)}[{Weapons.Count}] - {Session.GridTargetingAIs[comp.MyCube.CubeGrid].WeaponBase.ContainsKey(comp.MyCube)} - {Session.GridTargetingAIs[comp.MyCube.CubeGrid].WeaponBase.Count} ");
                    return;
                }

                if (comp.HasArmor)
                {
                    for (int i = 0; i < comp.Platform.Weapons.Length; i++)
                    {
                        var w = comp.Platform.Weapons[i];
                        if (w.System.Armor != WeaponDefinition.HardPointDef.HardwareDef.ArmorState.IsWeapon)
                        {
                            Armor.Remove(w.Comp.MyCube);
                        }
                    }
                    Session.ArmorCubes.Remove(comp.MyCube);
                }

                Weapons.RemoveAtFast(idx);
                if (idx < Weapons.Count)
                {
                    WeaponsIdx[Weapons[idx]] = idx;
                }

                //Session.IdToCompMap.Remove(comp.MyCube.EntityId);
                WeaponsIdx.Remove(comp);
            }
        }
Ejemplo n.º 60
0
 private void ReplaceWeapon(Weapon oldWeapon, Weapon newWeapon)
 {
     DropWeapon(oldWeapon.WeaponData.SystemName);
     Weapons.Remove(oldWeapon);
     Weapons.Add(newWeapon);
 }