public static WeaponDefinition GetWeaponDefinition( WeaponType wt ) { if (W_DEFS.ContainsKey (wt)) return W_DEFS [wt]; return new WeaponDefinition (); }
public void initialize() { energy = 100; weaponLevel = 5; weaponType = WeaponType.BARE_HANDS; health = 10; }
/// <summary> /// Create an item for the player or enemy /// </summary> /// <param name="SlotType">What type of slot this item uses</param> /// <param name="Location">The location of this slot, relative to the user</param> /// <param name="WeaponType">What type of weapon this item is</param> public WeaponBay(Vector2 Location, Boolean PlayerOwned, WeaponType WeaponType, Vector2 Direction, Texture2D ProjectileTexture) : base(SlotType.WeaponBay, Location, PlayerOwned) { wtWeaponType = WeaponType; v2Direction = Direction; t2dProjectile = ProjectileTexture; }
public static WeaponDefinition GetWeaponDefinition(WeaponType wt) { if (W_DEFS.ContainsKey (wt)) { return(W_DEFS[wt]); } return(new WeaponDefinition()); }
int damage; //Amount of damage to deal. public ItemWeapon(int id) { this.id = id; this.type = Type.Weapon; if (id == 0) { element = Element.ETHER; weaponType = WeaponType.KNIFE; textureName = "knife"; name = "Test Weapon"; description[0] = "A test weapon"; description[1] = "You shouldn't have this."; } if (id == 1) { textureName = "knifeRust"; name = "Test Weapon 2"; description[0] = "THE second test weapon."; description[1] = "You shouldn't have this."; description[2] = "although you probably can later."; } }
public void activateWeapon(WeaponType weapon) { switch(weapon){ case WeaponType.NONE: equippedWeapon = null; break; case WeaponType.MINIGUN: equippedWeapon = minigunComp; break; case WeaponType.ROCKET_LAUNCHER: equippedWeapon = rocketLauncherComp; break; case WeaponType.SPIKES: equippedWeapon = spikeHandleComp; break; case WeaponType.MINE_THROWER: equippedWeapon = mineThrowerComp; break; } if(equippedWeapon != null) equippedWeaponNumber = (int)equippedWeapon.weaponType; /* if(equippedWeapon != null) equippedWeapon.reset(); */ }
void Start() { if(Type == WeaponType.Off) { if(GetComponent<Weapon_Beam>() != null) Type = WeaponType.Beam; if(GetComponent<Weapon_Projectile>() != null) Type = WeaponType.Projectile; } if(Type == WeaponType.Beam && GetComponent<Weapon_Beam>() == null) Debug.Log("No Beam Module Attached"); if(Type == WeaponType.Projectile && GetComponent<Weapon_Projectile>() == null) Debug.Log("No Projectile Module Attached"); if(Type == WeaponType.Beam && GetComponent<Weapon_Beam>().GetType() != typeof(Weapon_Beam)) { Debug.Log("Weapon Type Mismatch"); } if(Type == WeaponType.Projectile && GetComponent<Weapon_Projectile>().GetType() != typeof(Weapon_Projectile)) { Debug.Log("Weapon Type Mismatch"); } if(Type == WeaponType.Effect && GetComponent<Weapon_Effect>().GetType() != typeof(Weapon_Effect)) { Debug.Log("Weapon Type Mismatch"); } if(Type == WeaponType.Effect && GetComponent<Weapon_Effect>() == null) { Debug.Log("No Effect Module Attached"); } thisTransform = transform; thisTransform.FindChild("B_Spawn"); }
public void SetType(WeaponType eType) { // Set the _type _type = eType; WeaponDefinition def = Main.GetWeaponDefinition(_type); GetComponent<Renderer>().material.color = def.projectileColor; }
public static Weapon Create(WeaponType weaponType) { Weapon newWeapon; switch (weaponType) { case WeaponType.Sword: newWeapon = new Sword(_content, _graphics); break; case WeaponType.Mace: newWeapon = new Mace(_content, _graphics); break; case WeaponType.Axe: newWeapon = new Axe(_content, _graphics); break; case WeaponType.Hammer: newWeapon = new Hammer(_content, _graphics); break; default: throw new InvalidWeaponException(weaponType); } newWeapon.Load(); return newWeapon; }
public Weapon(WeaponType type, string name, int price, float fireRate) { FireRate = fireRate; Price = price; WeaponType = type; Name = name; }
/// <summary> /// Creates a new weapon /// </summary> /// <param name="world">The world to add the weapon to</param> /// <param name="position">The position to create the weapon at</param> /// <param name="type">The type of weapon</param> /// <param name="width">The width of the weapon</param> /// <param name="height">The height of the weapon</param> /// <param name="mass">The mass of the weapon</param> public Weapon(World world, Vector2 position, WeaponType type, float width, float height, float density) { this.world = world; this.ammoCapacity = 0; this.ammo = 0; this.clipSize = 0; this.clipAmmo = 0; this.refireTime = 0; refireCount = 0; this.reloadTime = 0; reloadCount = 0; reloading = false; this.type = type; gun = BodyFactory.CreateRectangle(world, width, height, density); gun.BodyType = BodyType.Dynamic; gun.Position = position; gun.Restitution = 0.3f; gun.UserData = this; gun.CollisionCategories = Category.All; gun.CollidesWith = Category.All; gun.OnCollision += new OnCollisionEventHandler(ResetCollisionCategory); }
//Note that there ARE some differences between sword, axe, and hammer calculations public void UpdateSize(WeaponType newType, float bladeScale, float handleScale) { //TODO - make small blade + large handle not horribly broken if (newType == WeaponType.SWORD) { //The sword handle scale gets a special calculation applied to map the 1-2 scale to a 1-12 scale handleTrans.localScale = new Vector3 (DEFAULT_SWORD_HANDLE_SCALE.x, (DEFAULT_SWORD_HANDLE_SCALE.y * (((handleScale - 1.6f) * 6f) + 10f)) + DEFAULT_SWORD_HANDLE_LENGTH_OFFSET, DEFAULT_SWORD_HANDLE_SCALE.z); handleTrans.localPosition = DEFAULT_SWORD_HANDLE_POS; bladeTrans.localScale = new Vector3 (DEFAULT_SWORD_BLADE_SCALE.x * bladeScale, DEFAULT_SWORD_BLADE_SCALE.y * bladeScale, DEFAULT_SWORD_BLADE_SCALE.z); //Weird math to get the blade in the right spot bladeTrans.localPosition = new Vector3 (DEFAULT_SWORD_HANDLE_POS.x, handleTrans.localPosition.y + (handleTrans.localScale.y / 2) + (bladeTrans.localScale.y / 2) + DEFAULT_SWORD_BLADE_OFFSET, DEFAULT_SWORD_HANDLE_POS.z); } else if (newType == WeaponType.AXE) { handleTrans.localScale = new Vector3 (DEFAULT_AXE_HANDLE_SCALE.x, DEFAULT_AXE_HANDLE_SCALE.y * handleScale, DEFAULT_AXE_HANDLE_SCALE.z); handleTrans.localPosition = new Vector3 (DEFAULT_AXE_HANDLE_POS.x, DEFAULT_AXE_HANDLE_POS.y * handleScale * .75f, DEFAULT_AXE_HANDLE_POS.z); bladeTrans.localScale = new Vector3 (DEFAULT_AXE_BLADE_SCALE.x * bladeScale, DEFAULT_AXE_BLADE_SCALE.y * bladeScale, DEFAULT_AXE_BLADE_SCALE.z); //Weird math to get the blade in the right spot bladeTrans.localPosition = new Vector3 (DEFAULT_AXE_HANDLE_POS.x, handleTrans.localPosition.y + (handleTrans.localScale.y / 2) - (bladeTrans.localScale.y / 2) + DEFAULT_AXE_BLADE_OFFSET, DEFAULT_AXE_HANDLE_POS.z); } else if (newType == WeaponType.HAMMER) { handleTrans.localScale = new Vector3 (DEFAULT_HAMMER_HANDLE_SCALE.x, DEFAULT_HAMMER_HANDLE_SCALE.y * handleScale, DEFAULT_HAMMER_HANDLE_SCALE.z); handleTrans.localPosition = new Vector3 (DEFAULT_HAMMER_HANDLE_POS.x, DEFAULT_HAMMER_HANDLE_POS.y * handleScale * .75f, DEFAULT_HAMMER_HANDLE_POS.z); bladeTrans.localScale = new Vector3 (DEFAULT_HAMMER_BLADE_SCALE.x * bladeScale, DEFAULT_HAMMER_BLADE_SCALE.y * bladeScale, DEFAULT_HAMMER_BLADE_SCALE.z * bladeScale); //Weird math to get the blade in the right spot bladeTrans.localPosition = new Vector3 (DEFAULT_HAMMER_HANDLE_POS.x, handleTrans.localPosition.y + (handleTrans.localScale.y / 2) - (bladeTrans.localScale.y / 2) + DEFAULT_HAMMER_BLADE_OFFSET, DEFAULT_HAMMER_HANDLE_POS.z); } }
public void SetType(WeaponType wt) { WeaponDefinition def = Main.GetWeaponDefinition (wt); cube.renderer.material.color = def.color; letter.text = def.letter; type = wt; }
public Item(GraphicsDeviceManager g, ContentManager c, int weapon, Vector2 startLoc, Vector2 playerDim) { graphics = g; content = c; dimensions = new Vector2(90, 120); loc = new Vector2(startLoc.X - playerDim.X / 2, startLoc.Y - playerDim.Y / 3); random = new Random(); if (weapon == 0) { LoadContent("Textures/ShortSwordWalk"); vitality = 0; dexterity = 0; intelligence = 0; strength = 0; critBonus = 0; critChance = 0; minDmg = 1f; maxDmg = 5f; statType = StatType.str; weaponType = WeaponType.slash; atkSpd = 1f; } animation = new SpriteAnimation(8, itemSpriteSheet, .45, new Rectangle((int)loc.X, (int)loc.Y, (int)dimensions.X, (int)dimensions.Y)); }
public static int getModifier(WeaponType weaponType, EnemyType enemyType) { if (weaponType == WeaponType.BARE_HANDS) { if (enemyType == EnemyType.Spider) { return 1; } else if (enemyType == EnemyType.Zombie) { return -1; } else { return 0; } } else if (weaponType == WeaponType.STAFF) { if (enemyType == EnemyType.Spider) { return -1; } else if (enemyType == EnemyType.Zombie) { return 0; } else { return 1; } } else if (weaponType == WeaponType.SWORD) { if (enemyType == EnemyType.Spider) { return 0; } else if (enemyType == EnemyType.Zombie) { return 1; } else { return -1; } } else { return 0; } }
public void UnlockWeapon(WeaponType type) { if(!UnlockedWeapons.Contains (type)) { UnlockedWeapons.Add (type); } }
public void UpdateStats(WeaponType newType = WeaponType.AXE, float newHandleLength = 1.0f, float newHeadSize = 1.0f) { type = newType; handleLength = newHandleLength; headSize = newHeadSize; //TODO - balance these? //DPS is identical on all weapons, but bigger weapons also get larger knockback and reach, so... damageMod = headSize * handleLength; knockbackMod = headSize * handleLength; attackTime = headSize * handleLength; switch (type) { case WeaponType.AXE: damageMod *= GLOBAL_AXE_DAMAGE_MOD; knockbackMod *= GLOBAL_AXE_KNOCKBACK_MOD; attackTime *= GLOBAL_AXE_ATTACK_TIME_MOD; break; case WeaponType.HAMMER: damageMod *= GLOBAL_HAMMER_DAMAGE_MOD; knockbackMod *= GLOBAL_HAMMER_KNOCKBACK_MOD; attackTime *= GLOBAL_HAMMER_ATTACK_TIME_MOD; break; //Other weapons default to sword stats default: damageMod *= GLOBAL_SWORD_DAMAGE_MOD; knockbackMod *= GLOBAL_SWORD_KNOCKBACK_MOD; attackTime *= GLOBAL_SWORD_ATTACK_TIME_MOD; break; } }
public DeathInfo(float LastDamage, WeaponType DamageType, SourceType SourceType, Unit Killer = null) { this.DamageType = DamageType; this.LastDamage = LastDamage; this.SourceType = SourceType; this.Killer = Killer; }
/// <summary> /// Create a new weapon /// </summary> /// <param name="name">name of the weapon</param> /// <param name="type">class of weapon</param> /// <param name="hulls">class fo ship that can mount this weapon</param> /// <param name="slots">locatiosn where this weapon can be mounted</param> /// <param name="power">power used by this weapon</param> /// <param name="space">space used by this method</param> /// <param name="sp">cost of this weapon</param> /// <param name="str">strength of the weapon</param> /// <param name="damage">damage of the weapon</param> /// <param name="crit">crit rating of the weapon</param> /// <param name="range">range of the weapon</param> /// <param name="origin">rulebook containing this weapon</param> /// <param name="page">page this weapon can be found on</param> /// <param name="quality">quality of this weapon</param> /// <param name="wq">enum declaring which qualities to be adjusted</param> /// <param name="special">special rules of this weapon</param> /// <param name="turbo">Quality of turboweapon battery upgrade if applicable</param> public Weapon(string name, WeaponType type, HullType hulls, WeaponSlot slots, int power, int space, int sp, int str, string damage, int crit, int range, RuleBook origin, byte page, Quality quality = Quality.Common, WeaponQuality wq = WeaponQuality.None, string special = null, Quality turbo = Quality.None, ComponentOrigin comp = ComponentOrigin.Standard, Condition cond = Condition.Intact) : this(name, type, hulls, slots, power, space, sp, str, new DiceRoll(damage), crit, range, origin, page, quality, wq, special, turbo, comp, cond) { }
public float GetAmmo(WeaponType offset) { // proc not running? if(CanRead && _baseAddress > 0) { return 0f; } var bytesRead = 0; // yo dawg I heard you like pointers so I'mma point to these pointers that // point to pointers, get the point(ers)? if(!_finalLocations.ContainsKey(offset)) { byte[] p1a = _bl2.ReadMemory(_baseAddress + BASE_OFFSET, 4, out bytesRead); int p1v = BitConverter.ToInt32(p1a, 0); byte[] p2a = _bl2.ReadMemory(p1v + 0x2c, 4, out bytesRead); int p2v = BitConverter.ToInt32(p2a, 0); byte[] p3a = _bl2.ReadMemory(p2v + (int)offset, 4, out bytesRead); int p3v = BitConverter.ToInt32(p3a, 0); // lets cache the actual ammo location so we're not doing this every time we check for ammo _finalLocations[offset] = p3v; } byte[] ammo = _bl2.ReadMemory(_finalLocations[offset] + 0x6c, 4, out bytesRead); return BitConverter.ToSingle(ammo, 0); }
// note constructor inheritance from base class public Weapon( WeaponType type, string name, string description) : base(name, description) { }
public Weapon(WeaponType type, int power, bool disabling, int price, TechLevel minTechLevel, int chance): base(EquipmentType.Weapon, price, minTechLevel, chance) { _type = type; _power = power; _disabling = disabling; }
// public int speed = 0; public Creature(World world, int location_x, int location_y, float hp, ArmorType armor, WeaponType weapon, float atk, float def, int area, int movement, int range = 1) : base(world, location_x, location_y, hp, area, movement) { Armor = armor; Weapon = weapon; Range = range; // Units = unit; // Here speed is treated as priority for attacking. The party has higher speed attacks first. // Here we calcuate speed bonus for Armors. if (Armor == ArmorType.Cloth) Speed += 10; else if (Armor == ArmorType.Leather) Speed += 8; else if (Armor == ArmorType.Wooden) Speed += 6; else if (Armor == ArmorType.Mail) Speed += 4; else if (Armor == ArmorType.Plate) Speed += 3; // Here we calcuate speed bonus for Weapons. if (Weapon == WeaponType.Light) Speed += 6; else if (Weapon == WeaponType.Piercing) Speed += 4; else if (Weapon == WeaponType.Heavy) Speed += 2; else if (Weapon == WeaponType.Energy) Speed += 3; Def = def + (int)Armor; Atk = atk; }
public Player(ContentManager content, GraphicsDeviceManager graphics) { _content = content; _graphics = graphics; _health = Settings.PlayerMaxHealth; Strength = Settings.PlayerMaxStrength; Shield = Settings.PlayerMaxShield; _magic = Settings.PlayerMaxMagic; Score = 0; Kills = 0; activeSpell = SpellType.DragonBreath; activeWeapon = WeaponType.Sword; maceAvailable = false; axeAvailable = false; dying = false; Dead = false; dyingTick = 0.0f; loaded = false; Position = Vector3.Zero; Direction = 0.0f; healthTick = 0.0f; shieldTick = 0.0f; WeaponPosition = 0.0f; model = null; rotation = Matrix.Identity; }
public static Weapon CreateWeapon(WeaponType weaponType, float ammoMultiplier) { switch (weaponType) { case WeaponType.AssaultRifle: return new AssaultRifle(); case WeaponType.Shotgun: return new Shotgun(ammoMultiplier); case WeaponType.RocketLauncher: return new RocketLauncher(ammoMultiplier); case WeaponType.Laser: return new Laser(ammoMultiplier); case WeaponType.Minigun: return new Minigun(ammoMultiplier); case WeaponType.Bouncer: return new Bouncer(ammoMultiplier); case WeaponType.Flamethrower: return new Flamethrower(ammoMultiplier); case WeaponType.Waterblaster: return new Waterthrower(ammoMultiplier); default: throw new ArgumentOutOfRangeException("weaponType"); } }
protected IWeapon(int damage, int durability, WeaponType type, List<Rune> runes) { this.damage = damage; this.durability = this.currentDurability = durability; this.type = type; this.runes = runes; }
public Weapon(string texturePath, Rectangle rectangle, int speed, int damage, WeaponType type, string name) : base(texturePath, rectangle, speed) { this.WeaponType = type; this.Damage = damage; this.Name = name; }
// Use this for initialization public Weapon(WeaponType Type) { Weapontype = Type; //left? Facing = ItemFacing.Left; switch (Type) { case WeaponType.Axe: break; case WeaponType.Pistol: break; case WeaponType.Rifle: ItemSprite = GameObject.CreatePrimitive(PrimitiveType.Plane); ItemSprite.transform.localScale = new Vector3(-(0.5f / SizeMod), 1.0f, -(0.2f / SizeMod)); Texture tex = (Texture)UnityEditor.AssetDatabase.LoadAssetAtPath("Assets\\Resources\\Drawings\\Weapons\\rifle.png", typeof(Texture)); ItemSprite.GetComponent<Renderer>().material = (Material)UnityEditor.AssetDatabase.LoadAssetAtPath("Assets\\Resources\\Drawings\\Weapons\\rifle.mat", typeof(Material)); ItemSprite.transform.rotation = Quaternion.AngleAxis(TargetAngle, -Vector3.up); break; } }
public void SetHitPct(bool hit, WeaponType weapon) { switch (weapon) { case WeaponType.Bullet: bulletsFired++; if(hit) { bulletsHit++; } bulletHitPct = (bulletsHit / bulletsFired) * 100; break; case WeaponType.Laser: lasersFired++; if (hit) { lasersHit++; } laserHitPct = (lasersHit / lasersFired) * 100; break; case WeaponType.Rocket: rocketsFired++; if (hit) { rocketsHit++; } rocketHitPct = (rocketsHit / rocketsFired) * 100; break; } }
public Weapon(string _name, DmgType _dmgType, int _physDmgAmt, EleDmgType _eleDmgType, int _eleDmgAmt, int _range) : base() { Name = _name; Id = (double)UnityEngine.Random.Range(0, 1000000000); Range = _range; EleDmgAmt = _eleDmgAmt; PhysDmgAmt = _physDmgAmt; PhysDmg = _dmgType; EleDmg = _eleDmgType; if (Range < 2) { WeapType = WeaponType.Low; } else if (Range < 4) { WeapType = WeaponType.Medium; } else if (Range < 10) { WeapType = WeaponType.High; } else if (Range < 30) { WeapType = WeaponType.RLow; } else { WeapType = WeaponType.RHigh; } Id = Database.WeaponDbInsert(this); }
public override void Update(GameTime gameTime) { keyboardState = Keyboard.GetState(); MouseState mouseState = Mouse.GetState(); Vector2 mouseLocation = new Vector2(mouseState.X, mouseState.Y); mouseLocation -= Position; Rotation = (float)Math.Atan2(mouseLocation.Y, mouseLocation.X); // fires weapon if Fire Rate is ready if (canFire) { // check for left mouse pressed and fire event if (mouseState.LeftButton == ButtonState.Pressed) { FireWeapon(); } } previousMouse = mouseState; //Update timer fireTimer.Update(gameTime.ElapsedGameTime); #region Movement //Movement if (keyboardState.IsKeyDown(Keys.W)) { Position.Y -= moveSpeed; } if (keyboardState.IsKeyDown(Keys.S)) { Position.Y += moveSpeed; } if (keyboardState.IsKeyDown(Keys.A)) { Position.X -= moveSpeed; } if (keyboardState.IsKeyDown(Keys.D)) { Position.X += moveSpeed; } #endregion #region Change Weapon //Change weapon if (keyboardState.IsKeyDown(Keys.D1)) { weaponType = WeaponType.WaterGun; } if (keyboardState.IsKeyDown(Keys.D2)) { weaponType = WeaponType.SlingShot; } if (keyboardState.IsKeyDown(Keys.D3)) { weaponType = WeaponType.DonutGun; } #endregion base.Update(gameTime); }
internal WeaponBlockBase(BinaryReader binaryReader) : base(binaryReader) { this.flags = (Flags)binaryReader.ReadInt32(); this.invalidName_ = binaryReader.ReadStringID(); this.secondaryTriggerMode = (SecondaryTriggerMode)binaryReader.ReadInt16(); this.maximumAlternateShotsLoaded = binaryReader.ReadInt16(); this.turnOnTime = binaryReader.ReadSingle(); this.readyTimeSeconds = binaryReader.ReadSingle(); this.readyEffect = binaryReader.ReadTagReference(); this.readyDamageEffect = binaryReader.ReadTagReference(); this.heatRecoveryThreshold01 = binaryReader.ReadSingle(); this.overheatedThreshold01 = binaryReader.ReadSingle(); this.heatDetonationThreshold01 = binaryReader.ReadSingle(); this.heatDetonationFraction01 = binaryReader.ReadSingle(); this.heatLossPerSecond01 = binaryReader.ReadSingle(); this.heatIllumination01 = binaryReader.ReadSingle(); this.overheatedHeatLossPerSecond01 = binaryReader.ReadSingle(); this.overheated = binaryReader.ReadTagReference(); this.overheatedDamageEffect = binaryReader.ReadTagReference(); this.detonation = binaryReader.ReadTagReference(); this.detonationDamageEffect = binaryReader.ReadTagReference(); this.playerMeleeDamage = binaryReader.ReadTagReference(); this.playerMeleeResponse = binaryReader.ReadTagReference(); this.meleeAimAssist = new MeleeAimAssistStructBlock(binaryReader); this.meleeDamageParameters = new MeleeDamageParametersStructBlock(binaryReader); this.meleeDamageReportingType = (MeleeDamageReportingType)binaryReader.ReadByte(); this.invalidName_0 = binaryReader.ReadBytes(1); this.magnificationLevels = binaryReader.ReadInt16(); this.magnificationRange = binaryReader.ReadRange(); this.weaponAimAssist = new AimAssistStructBlock(binaryReader); this.movementPenalized = (MovementPenalized)binaryReader.ReadInt16(); this.invalidName_1 = binaryReader.ReadBytes(2); this.forwardMovementPenalty = binaryReader.ReadSingle(); this.sidewaysMovementPenalty = binaryReader.ReadSingle(); this.aIScariness = binaryReader.ReadSingle(); this.weaponPowerOnTimeSeconds = binaryReader.ReadSingle(); this.weaponPowerOffTimeSeconds = binaryReader.ReadSingle(); this.weaponPowerOnEffect = binaryReader.ReadTagReference(); this.weaponPowerOffEffect = binaryReader.ReadTagReference(); this.ageHeatRecoveryPenalty = binaryReader.ReadSingle(); this.ageRateOfFirePenalty = binaryReader.ReadSingle(); this.ageMisfireStart01 = binaryReader.ReadSingle(); this.ageMisfireChance01 = binaryReader.ReadSingle(); this.pickupSound = binaryReader.ReadTagReference(); this.zoomInSound = binaryReader.ReadTagReference(); this.zoomOutSound = binaryReader.ReadTagReference(); this.activeCamoDing = binaryReader.ReadSingle(); this.activeCamoRegrowthRate = binaryReader.ReadSingle(); this.handleNode = binaryReader.ReadStringID(); this.weaponClass = binaryReader.ReadStringID(); this.weaponName = binaryReader.ReadStringID(); this.multiplayerWeaponType = (MultiplayerWeaponType)binaryReader.ReadInt16(); this.weaponType = (WeaponType)binaryReader.ReadInt16(); this.tracking = new WeaponTrackingStructBlock(binaryReader); this.playerInterface = new WeaponInterfaceStructBlock(binaryReader); this.predictedResources = ReadPredictedResourceBlockArray(binaryReader); this.magazines = ReadMagazinesArray(binaryReader); this.newTriggers = ReadWeaponTriggersArray(binaryReader); this.barrels = ReadWeaponBarrelsArray(binaryReader); this.invalidName_2 = binaryReader.ReadBytes(8); this.maxMovementAcceleration = binaryReader.ReadSingle(); this.maxMovementVelocity = binaryReader.ReadSingle(); this.maxTurningAcceleration = binaryReader.ReadSingle(); this.maxTurningVelocity = binaryReader.ReadSingle(); this.deployedVehicle = binaryReader.ReadTagReference(); this.ageEffect = binaryReader.ReadTagReference(); this.agedWeapon = binaryReader.ReadTagReference(); this.firstPersonWeaponOffset = binaryReader.ReadVector3(); this.firstPersonScopeSize = binaryReader.ReadVector2(); }
public StatusEffectConfig(string groupId, string nameStringId, MemorySource source, string timerOffset, WeaponType weaponType) { GroupId = groupId; NameStringId = nameStringId; Source = source; TimerOffset = timerOffset; WeaponType = weaponType; }
protected override void OnTarget(Mobile from, object targeted) { if (targeted is BaseWeapon) { if (from.CheckTargetSkill(SkillName.ArmsLore, targeted, 0, 100)) { BaseWeapon weap = (BaseWeapon)targeted; if (weap.MaxHits != 0) { int hp = (int)((weap.Hits / (double)weap.MaxHits) * 10); if (hp < 0) { hp = 0; } else if (hp > 9) { hp = 9; } from.SendLocalizedMessage(1038285 + hp); } int damage = (weap.MaxDamage + weap.MinDamage) / 2; int hand = (weap.Layer == Layer.OneHanded ? 0 : 1); if (damage < 3) { damage = 0; } else if (damage < 6) { damage = 1; } else if (damage < 11) { damage = 2; } else if (damage < 16) { damage = 3; } else if (damage < 21) { damage = 4; } else if (damage < 26) { damage = 5; } else { damage = 6; } WeaponType type = weap.Type; if (type == WeaponType.Ranged) { from.SendLocalizedMessage(1038224 + (damage * 9)); } else if (type == WeaponType.Piercing) { from.SendLocalizedMessage(1038218 + hand + (damage * 9)); } else if (type == WeaponType.Slashing) { from.SendLocalizedMessage(1038220 + hand + (damage * 9)); } else if (type == WeaponType.Bashing) { from.SendLocalizedMessage(1038222 + hand + (damage * 9)); } else { from.SendLocalizedMessage(1038216 + hand + (damage * 9)); } if (weap.Poison != null && weap.PoisonCharges > 0) { from.SendLocalizedMessage(1038284); // It appears to have poison smeared on it. } } else { from.SendLocalizedMessage(500353); // You are not certain... } } else if (targeted is BaseArmor) { if (from.CheckTargetSkill(SkillName.ArmsLore, targeted, 0, 100)) { BaseArmor arm = (BaseArmor)targeted; if (arm.MaxHitPoints != 0) { int hp = (int)((arm.HitPoints / (double)arm.MaxHitPoints) * 10); if (hp < 0) { hp = 0; } else if (hp > 9) { hp = 9; } from.SendLocalizedMessage(1038285 + hp); } if (arm.ArmorRating < 1) { from.SendLocalizedMessage(1038295); // This armor offers no defense against attackers. } else if (arm.ArmorRating < 6) { from.SendLocalizedMessage(1038296); // This armor provides almost no protection. } else if (arm.ArmorRating < 11) { from.SendLocalizedMessage(1038297); // This armor provides very little protection. } else if (arm.ArmorRating < 16) { from.SendLocalizedMessage(1038298); // This armor offers some protection against blows. } else if (arm.ArmorRating < 21) { from.SendLocalizedMessage(1038299); // This armor serves as sturdy protection. } else if (arm.ArmorRating < 26) { from.SendLocalizedMessage(1038300); // This armor is a superior defense against attack. } else if (arm.ArmorRating < 31) { from.SendLocalizedMessage(1038301); // This armor offers excellent protection. } else { from.SendLocalizedMessage(1038302); // This armor is superbly crafted to provide maximum protection. } } else { from.SendLocalizedMessage(500353); // You are not certain... } } else if (targeted is SwampDragon && ((SwampDragon)targeted).HasBarding) { SwampDragon pet = (SwampDragon)targeted; if (from.CheckTargetSkill(SkillName.ArmsLore, targeted, 0, 100)) { int perc = (4 * pet.BardingHP) / pet.BardingMaxHP; if (perc < 0) { perc = 0; } else if (perc > 4) { perc = 4; } pet.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1053021 - perc, from.NetState); } else { from.SendLocalizedMessage(500353); // You are not certain... } } else { from.SendLocalizedMessage(500352); // This is neither weapon nor armor. } }
private void Awake() { _currentType = WeaponType.Autogun; SetWeaponImage(_autogun); _controller.ChangeWeapon(WeaponType.Autogun); }
public void Construct(WeaponType weaponType, RuntimeAnimatorController animationController, Sprite sprite) { WeaponType = weaponType; AnimationController = animationController; Sprite = sprite; }
/// <summary> /// Set Heritage based Melee and Ranged Masteries /// </summary> private static void GetMasteries(HeritageGroup heritageGroup, out WeaponType meleeMastery, out WeaponType rangedMastery) { switch (heritageGroup) { case HeritageGroup.Aluvian: meleeMastery = WeaponType.Dagger; rangedMastery = WeaponType.Bow; break; case HeritageGroup.Gharundim: meleeMastery = WeaponType.Staff; rangedMastery = WeaponType.Magic; break; case HeritageGroup.Sho: meleeMastery = WeaponType.Unarmed; rangedMastery = WeaponType.Bow; break; case HeritageGroup.Viamontian: meleeMastery = WeaponType.Sword; rangedMastery = WeaponType.Crossbow; break; case HeritageGroup.Penumbraen: case HeritageGroup.Shadowbound: meleeMastery = WeaponType.Unarmed; rangedMastery = WeaponType.Crossbow; break; case HeritageGroup.Gearknight: meleeMastery = WeaponType.Mace; rangedMastery = WeaponType.Crossbow; break; case HeritageGroup.Tumerok: meleeMastery = WeaponType.Spear; rangedMastery = WeaponType.Thrown; break; case HeritageGroup.Undead: case HeritageGroup.Lugian: meleeMastery = WeaponType.Axe; rangedMastery = WeaponType.Thrown; break; case HeritageGroup.Empyrean: meleeMastery = WeaponType.Sword; rangedMastery = WeaponType.Magic; break; default: meleeMastery = WeaponType.Undef; rangedMastery = WeaponType.Undef; break; } }
private Weapon(string name, string pictureUrl, uint kineticDamage, uint thermalDamage, uint explosiveDamage, uint electromagneticDamage, WeaponType type) { Type = type; Name = name; }
// Use this for initialization void Start() { shapeInfo = GetComponent <IngotShape>(); type = WeaponType.ingot; }
public bool GetHeritageBonus(WeaponType weaponType) { switch (HeritageGroup) { case HeritageGroup.Aluvian: if (weaponType == WeaponType.Dagger || weaponType == WeaponType.Bow) { return(true); } break; case HeritageGroup.Gharundim: if (weaponType == WeaponType.Staff || weaponType == WeaponType.Magic) { return(true); } break; case HeritageGroup.Sho: if (weaponType == WeaponType.Unarmed || weaponType == WeaponType.Bow) { return(true); } break; case HeritageGroup.Viamontian: if (weaponType == WeaponType.Sword || weaponType == WeaponType.Crossbow) { return(true); } break; case HeritageGroup.Shadowbound: // umbraen case HeritageGroup.Penumbraen: if (weaponType == WeaponType.Unarmed || weaponType == WeaponType.Crossbow) { return(true); } break; case HeritageGroup.Gearknight: if (weaponType == WeaponType.Mace || weaponType == WeaponType.Crossbow) { return(true); } break; case HeritageGroup.Undead: if (weaponType == WeaponType.Axe || weaponType == WeaponType.Thrown) { return(true); } break; case HeritageGroup.Empyrean: if (weaponType == WeaponType.Sword || weaponType == WeaponType.Magic) { return(true); } break; case HeritageGroup.Tumerok: if (weaponType == WeaponType.Spear || weaponType == WeaponType.Thrown) { return(true); } break; case HeritageGroup.Lugian: if (weaponType == WeaponType.Axe || weaponType == WeaponType.Thrown) { return(true); } break; case HeritageGroup.Olthoi: case HeritageGroup.OlthoiAcid: break; } return(false); }
/// <summary> /// 空构造函数,初始化一个占位用的装备 /// </summary> public Equipment() { itemId = -1; weaponType = WeaponType.None; }
public void SelectWeaponType(WeaponType weaponType) { SelectedWeaponType = weaponType; }
public Fist(WeaponType wtype, WeaponAffix waffix) : base(wtype, waffix) { _maxGimickResource = 100; }
/// <summary> /// 构造函数 /// </summary> public Equipment(EquipmentModel equipmentModel, int itemCount) { this.itemType = ItemType.Equipment; this.itemCount = itemCount; // 初始化物品基本属性 InitBaseProperties(equipmentModel); // 初始化装备属性(默认初始化为灰色装备) this.oriMaxHealthGain = equipmentModel.maxHealthGain; this.oriMaxManaGain = equipmentModel.maxManaGain; this.oriAttackGain = equipmentModel.attackGain; this.oriMagicAttackGain = equipmentModel.magicAttackGain; this.oriArmorGain = equipmentModel.armorGain; this.oriMagicResistGain = equipmentModel.magicResistGain; this.oriArmorDecreaseGain = equipmentModel.armorDecreaseGain; this.oriMagicResistDecreaseGain = equipmentModel.magicResistDecreaseGain; this.attackSpeed = (AttackSpeed)equipmentModel.attackSpeed; this.oriMoveSpeedGain = equipmentModel.moveSpeedGain; this.oriCritGain = equipmentModel.critGain; this.oriDodgeGain = equipmentModel.dodgeGain; this.oriCritHurtScalerGain = equipmentModel.critHurtScalerGain; this.oriPhysicalHurtScalerGain = equipmentModel.physicalHurtScalerGain; this.oriMagicalHurtScalerGain = equipmentModel.magicalHurtScalerGain; this.oriExtraGoldGain = equipmentModel.extraGoldGain; this.oriExtraExperienceGain = equipmentModel.extraExperienceGain; this.oriHealthRecoveryGain = equipmentModel.healthRecoveryGain; this.oriMagicRecoveryGain = equipmentModel.magicRecoveryGain; // 基础价格 this.oriPrice = equipmentModel.price; // 实际价格【根据品质会在基础价格上有一定浮动】 this.price = equipmentModel.price; // 默认品质【初始化生成时默认的品质】 this.defaultQuality = equipmentModel.defaultQuality; // 装备类型 this.equipmentType = (EquipmentType)(equipmentModel.equipmentType); // 装备等级 this.equipmentGrade = equipmentModel.equipmentGrade; // 附加属性集 this.specProperties = equipmentModel.specProperties; // 按照默认属性初始化装备 switch (defaultQuality) { case EquipmentDefaultQuality.Random: RebuildEquipment(); break; case EquipmentDefaultQuality.Gold: quality = EquipmentQuality.Gold; ResetPropertiesByQuality(quality); break; case EquipmentDefaultQuality.Purple: quality = EquipmentQuality.Purple; ResetPropertiesByQuality(quality); break; case EquipmentDefaultQuality.Gray: quality = EquipmentQuality.Gray; ResetPropertiesByQuality(quality); break; } // 武器类型【该数据仅对于武器有用】 this.weaponType = equipmentModel.weaponType; // 镶嵌的宝石集合 attachedPropertyGemstones = new List <PropertyGemstone>(); // 初始化装备描述【属性转化为实际描述】 InitDescription(); }
public Weapon(Character pUser, WeaponType eWeaponType) : base(pUser, ItemType.Weapon) { m_eWeaponType = eWeaponType; }
public bool isWeaponOfType(WeaponType type) { return(this.weaponType == type); }
public void SetPrimary(WeaponType wt) { primaryWeapType = wt; }
public void SetWeaponType(WeaponType weaponType) { this.weaponType = weaponType; warnMsg = "按 E键 获取 " + weaponNameDict[this.weaponType]; }
public WeaponItem(int x, int y, string texte, Color backgroundColor, Color foregroundColor, string logoAsset, WeaponType id, bool selected = false) { X = x; Y = y; Identifier = id; _selector = new YnSprite(new Rectangle((int)X, (int)Y, 130, 20), foregroundColor); _selector.Visible = selected; _selector.Color *= 0.35f; Add(_selector); _label = new YnText("Fonts/HUD", texte, new Vector2(X, Y), Color.Yellow); _label.Scale = new Vector2(0.75f, 0.75f); Add(_label); _image = new YnSprite(new Vector2(X, Y), logoAsset); _image.Scale = new Vector2(0.4f); Add(_image); }
public SoldierCamp(GameObject gameObject, string name, string icon, SoldierType soldierType, Vector3 pos, float trainTime, WeaponType weaponType = WeaponType.Gun, int lv = 1) : base(gameObject, name, icon, soldierType, pos, trainTime) { m_Lv = lv; m_WeaponType = weaponType; m_EnergyCountStrategy = new SoldierEnergyCostStrategy(); UpdateEnergyCost(); }
public override void UpgradeWeapon() { m_WeaponType = m_WeaponType + 1; UpdateEnergyCost(); }
public InventoryItem(WeaponType weapon, int quantitiy = 0) { this.Weapon = weapon; this.Quantity = quantitiy; }
public Player getPlayer(string playerName) { Player p = null; using (SqlConnection connection = new SqlConnection(conn)) { connection.Open(); using (SqlCommand cmd = new SqlCommand("SELECT Class, CurrentRoomID, Lvl, MaxHP, HP, Attack, AttackPPA, AttackPReg, " + "MovePPM, Defence, WeaponID, WeaponDMG, WeaponCRT, WeaponType, WeaponName, XP FROM Players " + "INNER JOIN Weapons ON Players.CurrentWeaponID = Weapons.WeaponID WHERE PlayerName = @playerName", connection)) { cmd.Connection = connection; cmd.Parameters.Add("@playerName", SqlDbType.VarChar).Value = playerName; using (SqlDataReader reader = cmd.ExecuteReader()) { while (reader.Read()) { Class playerClass = KillerFUNwebApp1._0.Models.Enums.Class.Knight; //default playerClass is 'Knight' int currentRoom = reader.GetInt32(1); int lvl = reader.GetInt32(2); int maxHP = reader.GetInt32(3); int hp = reader.GetInt32(4); int attack = reader.GetInt32(5); int attackPointsPerAttack = reader.GetInt32(6); int attackPointsRegen = reader.GetInt32(7); int movePointsPerMove = reader.GetInt32(8); int defence = reader.GetInt32(9); int weaponID = reader.GetInt32(10); int weaponDMG = reader.GetInt32(11); int weaponCRT = reader.GetInt32(12); WeaponType weaponType = WeaponType.MonsterSlayer; //default weapontype is 'MonsterSlayer' string weaponName = reader.GetString(14); int xp = reader.GetInt32(15); string Class = reader.GetString(0); switch (Class) { case "Paladin": playerClass = KillerFUNwebApp1._0.Models.Enums.Class.Paladin; break; case "Crusader": playerClass = KillerFUNwebApp1._0.Models.Enums.Class.Crusader; break; case "Knight": playerClass = KillerFUNwebApp1._0.Models.Enums.Class.Knight; break; case "Barbarian": playerClass = KillerFUNwebApp1._0.Models.Enums.Class.Barbarian; break; } string type = reader.GetString(13); switch (type) { case "HumanSlayer": weaponType = WeaponType.HumanSlayer; break; case "MonsterSlayer": weaponType = WeaponType.MonsterSlayer; break; } Weapon w = new Weapon(weaponID, weaponDMG, weaponCRT, weaponType, weaponName); p = new Player(playerName, playerClass, lvl, hp, maxHP, attack, attackPointsPerAttack, attackPointsRegen, defence, movePointsPerMove, currentRoom, xp, w); } } } } return(p); }
private async Task <IList <Weapon> > GetWeaponsAsync(Task <string> contentProvider, WeaponType weaponType) { Stopwatch sw = Instrumentation.BeginNetworkMeasure(); string content = await contentProvider; Instrumentation.EndNetworkMeasure(sw); sw = Instrumentation.BeginProcessingMeasure(); IList <Weapon> result = ProcessContent(content, weaponType); Instrumentation.EndProcessingMeasure(sw); return(result); }
private IList <Weapon> ProcessContent(string content, WeaponType weaponType) { int currentPosition = 0; var weapons = new List <Weapon>(); while (currentPosition < content.Length) { Markup weaponImageMarkup = HtmlUtils.Until(content, ref currentPosition, m => m.Name == "img" && m.Classes.Contains("wp_img") && m.Properties.ContainsKey("src") && m.Properties["src"].StartsWith("http://s.mhwg.org/images/weapon2/w")); if (weaponImageMarkup == null) { break; } // === rarity ========================================================= string weaponRarityImageUrl = weaponImageMarkup.Properties["src"]; int rarity = TryGetRarity(weaponRarityImageUrl); // === name ========================================================= int closingTdIndex = content.IndexOf("</td>", currentPosition); if (closingTdIndex < 0) { throw BadFormat($"Missing closing 'td' for weapon name at position {currentPosition}"); } string weaponNameContent = content.Substring(currentPosition, closingTdIndex - currentPosition); string weaponName = GetWeaponName(weaponNameContent); if (weaponName == null) { throw BadFormat($"Could not determine weapon name at position {currentPosition}"); } // === attack ========================================================= Markup attackMarkup = HtmlUtils.Until(content, ref currentPosition, m => m.Name == "td" && m.Classes.Contains("b")); if (attackMarkup == null) { throw BadFormat($"Could not find attack markup for weapon '{weaponName}'"); } int attack; string attackStringValue = HtmlUtils.GetMarkupContent(content, attackMarkup); if (int.TryParse(attackStringValue, out attack) == false) { throw BadFormat($"Invalid attack numeric value '{(attackStringValue ?? "(null)")}' for weapon '{weaponName}'"); } // === element + misc ========================================================= Markup weaponElementMarkup = HtmlUtils.Until(content, ref currentPosition, m => m.Name == "td" && m.Classes.Length > 0); if (weaponElementMarkup == null) { throw BadFormat($"Could not find element markup for weapon '{weaponName}'"); } closingTdIndex = content.IndexOf("</td>", currentPosition); if (closingTdIndex < 0) { throw BadFormat($"Missing closing 'td' of element for weapon '{weaponName}'"); } string weaponElementContent = content.Substring(currentPosition, closingTdIndex - currentPosition); TryGetWeaponElement(weaponName, weaponElementContent, out int affinity, out int defense, out ElementInfo[] elementInfo, out EldersealLevel eldersealLevel);
public List <Player> getAllPlayers() { List <Player> playerList = new List <Player>(); using (SqlConnection connection = new SqlConnection(conn)) { connection.Open(); using (SqlCommand cmd = new SqlCommand("SELECT p.PlayerName, p.Class, p.CurrentRoomID, p.Lvl, p.MaxHP, p.HP, p.Attack, p.AttackPPA, p.AttackPReg, " + "p.MovePPM, p.Defence, w.WeaponID, w.WeaponDMG, w.WeaponCRT, w.WeaponType, w.WeaponName, p.XP FROM Players p " + "INNER JOIN Weapons w ON p.CurrentWeaponID = w.WeaponID")) { cmd.Connection = connection; using (SqlDataReader reader = cmd.ExecuteReader()) { while (reader.Read()) { string playerName = reader.GetString(0); Class playerClass = KillerFUNwebApp1._0.Models.Enums.Class.Knight; //default playerClass is 'Knight' int currentRoom = reader.GetInt32(2); int lvl = reader.GetInt32(3); int maxHP = reader.GetInt32(4); int hp = reader.GetInt32(5); int attack = reader.GetInt32(6); int attackPointsPerAttack = reader.GetInt32(7); int attackPointsRegen = reader.GetInt32(8); int movePointsPerMove = reader.GetInt32(9); int defence = reader.GetInt32(10); int weaponID = reader.GetInt32(11); int weaponDMG = reader.GetInt32(12); int weaponCRT = reader.GetInt32(13); WeaponType weaponType = WeaponType.MonsterSlayer; //default weapontype is 'MonsterSlayer' string weaponName = reader.GetString(15); int xp = reader.GetInt32(16); string Class = reader.GetString(1); switch (Class) { case "Paladin": playerClass = KillerFUNwebApp1._0.Models.Enums.Class.Paladin; break; case "Crusader": playerClass = KillerFUNwebApp1._0.Models.Enums.Class.Crusader; break; case "Knight": playerClass = KillerFUNwebApp1._0.Models.Enums.Class.Knight; break; case "Barbarian": playerClass = KillerFUNwebApp1._0.Models.Enums.Class.Barbarian; break; } string type = reader.GetString(14); switch (type) { case "HumanSlayer": weaponType = WeaponType.HumanSlayer; break; case "MonsterSlayer": weaponType = WeaponType.MonsterSlayer; break; } Weapon w = new Weapon(weaponID, weaponDMG, weaponCRT, weaponType, weaponName); Player p = new Player(playerName, playerClass, lvl, hp, maxHP, attack, attackPointsPerAttack, attackPointsRegen, defence, movePointsPerMove, currentRoom, xp, w); playerList.Add(p); } } } } return(playerList); }
public void SetWeapon(WeaponType type) { _weaponType = type; }
/// <summary> /// creates a Weapon of the type <paramref name="weaponType"/> with a random level /// </summary> /// <param name="weaponType"></param> /// <returns></returns> public Weapon CreateWeapon(WeaponType weaponType) { Weapon weapon; switch (weaponType) { case WeaponType.BOW: weapon = new Bow(WeaponType.BOW); break; case WeaponType.CROSSBOW: weapon = new Crossbow(WeaponType.CROSSBOW); break; case WeaponType.MAGESTAFF: weapon = new Magestaff(WeaponType.MAGESTAFF); break; case WeaponType.HANDCROSSBOW: weapon = new HandCrossbow(WeaponType.HANDCROSSBOW); break; case WeaponType.WAND: weapon = new Wand(WeaponType.WAND); break; case WeaponType.CEREMONIALKNIFE: weapon = new CeremonialKnife(WeaponType.CEREMONIALKNIFE); break; case WeaponType.DAGGER: weapon = new Dagger(WeaponType.DAGGER); break; case WeaponType.MACE: weapon = new Mace(WeaponType.MACE); break; case WeaponType.SCYTHE1H: weapon = new Scythe_1H(WeaponType.SCYTHE1H); break; case WeaponType.SWORD1H: weapon = new Sword1H(WeaponType.SWORD1H); break; case WeaponType.AXE: weapon = new Axe(WeaponType.AXE); break; case WeaponType.SCYTHE2H: weapon = new Scythe_2H(WeaponType.SCYTHE2H); break; case WeaponType.POLEARM: weapon = new Polearm(WeaponType.POLEARM); break; case WeaponType.SWORD2H: weapon = new Sword2H(WeaponType.SWORD2H); break; case WeaponType.STAFF: weapon = new Staff(WeaponType.STAFF); break; default: return(null); } weapon.ReqLevel = new Random().Next(1, 60); return(CreateWeaponStats(weapon)); }
public WeaponType getWeapon() { WeaponType ret = new WeaponType(bwapiPINVOKE.TechType_getWeapon(swigCPtr), true); return(ret); }
public Weapon(long weaponID, ContentManager content, string name, string modelPath, WeaponType weaponType, ProjectileType projectileType, float weaponDamage, float fireRate, int loadedAmmo, int totalAmmo) { this.weaponID = weaponID; this.name = name; this.weaponModel = LoadContent(content, modelPath); this.weaponType = weaponType; this.projectileType = projectileType; this.weaponDamage = weaponDamage; this.loadedAmmo = loadedAmmo; this.totalAmmo = totalAmmo; this.fireRate = new TimeSpan(0, 0, 0, 0, (int)fireRate); this.lastShot = DateTime.Now; this.reloadRate = new TimeSpan(0, 0, 0, 2, 0); this.lastReload = new DateTime(); }