/// <summary> /// Updates the last weapon used and kill count then announcing it to the public /// </summary> private void UpdateWeaponKill(Player from) { if (killStreaks.ContainsKey(from._alias)) { if (killStreaks[from._alias].lastUsedWeap == null) { return; } killStreaks[from._alias].lastUsedWepKillCount++; ItemInfo.Projectile lastUsedWep = killStreaks[from._alias].lastUsedWeap; switch (killStreaks[from._alias].lastUsedWepKillCount) { case 2: arena.sendArenaMessage(string.Format("{0} just got a double {1} kill.", from._alias, lastUsedWep.name), 17); break; case 3: arena.sendArenaMessage(string.Format("{0} just got a triple {1} kill!", from._alias, lastUsedWep.name), 18); break; case 4: arena.sendArenaMessage(string.Format("A 4 {0} kill by {0}?!?", lastUsedWep.name, from._alias), 19); break; case 5: arena.sendArenaMessage(string.Format("Unbelievable! {0} with the 5 {1} kill?", from._alias, lastUsedWep.name), 20); break; } } }
public static int getMaxBlastRadius(ItemInfo.Projectile wep) { int blastRadius = 0; if (wep.kineticDamageRadius > blastRadius) { blastRadius = wep.kineticDamageRadius; } if (wep.explosiveDamageRadius > blastRadius) { blastRadius = wep.explosiveDamageRadius; } if (wep.electronicDamageRadius > blastRadius) { blastRadius = wep.electronicDamageRadius; } if (wep.psionicDamageRadius > blastRadius) { blastRadius = wep.psionicDamageRadius; } if (wep.bypassDamageRadius > blastRadius) { blastRadius = wep.bypassDamageRadius; } if (wep.energyDamageRadius > blastRadius) { blastRadius = wep.energyDamageRadius; } return(blastRadius); }
/// <summary> /// Updates the last fired weapon and its ticker /// </summary> private void UpdateWeapon(Player from, ItemInfo.Projectile usedWep, int aliveTime) { if (killStreaks.ContainsKey(from._alias)) { killStreaks[from._alias].lastUsedWeap = usedWep; killStreaks[from._alias].lastUsedWepTick = DateTime.Now.AddTicks(aliveTime).Ticks; } }
public bool playerExplosion(Player player, ItemInfo.Projectile weapon, short posX, short posY, short posZ) { //Dog Tag? if (weapon.id == 1072) { player.Experience += 500; player.syncState(); player.sendMessage(0, "Dogtag reward: 500xp"); } return(true); }
public bool playerExplosion(Player player, ItemInfo.Projectile weapon, short posX, short posY, short posZ) { if (weapon.id == 999) {//Warp weapon player.warp(posX, posY); } if (weapon.id == 1282) {//Tower weapon _arena.newBot(typeof(Projectile), (ushort)104, player._team, null, player._state, this, player._team); } return(true); }
protected double _getEnergy; //For energy repair /////////////////////////////////////////////////// // Member Functions /////////////////////////////////////////////////// /// <summary> /// Generic constructor /// </summary> public Computer(VehInfo.Computer type, Arena arena) : base(type, arena) { _type = type; //Load the appropriate turret settings AssetManager am = Helpers._server._assets; //What is the gun we're going to be shooting? int wepID = type.InventoryItems[0]; //_arena.sendArenaMessage("wepid: " + wepID); if (wepID != 0) { //Find our primary weapon _primaryGun = am.getItemByID(wepID); _primaryGun.getAmmoType(out _ammoType, out _ammoCount, out _ammoCapacity); _ammoRemaining = _ammoCapacity; //What sort of if (_primaryGun is ItemInfo.MultiUse) { ItemInfo.MultiUse mug = (ItemInfo.MultiUse)_primaryGun; _reloadTime = mug.reloadDelayNormal * 10; _fireDelay = mug.fireDelay * 10; //Assume the first item is the tracking projectile _primaryProjectile = ((ItemInfo.Projectile)am.getItemByID(mug.childItems[0].id)); } else if (_primaryGun is ItemInfo.Projectile) { _primaryProjectile = (ItemInfo.Projectile)_primaryGun; _reloadTime = _primaryProjectile.reloadDelayNormal * 10; _fireDelay = _primaryProjectile.fireDelay * 10; } else { //Treat it as no weapon _primaryGun = null; } } else { _primaryGun = null; } configureComp(); }
public bool playerDamageEvent(Player player, ItemInfo.Projectile weapon, short posX, short posY, short posZ) { //Are they trying to catch? if (player.getInventoryAmount(28) > 0 && inPlayers.ContainsKey(player)) { //Yes, lets summon a teammate back in IEnumerable <Player> teamPlayers = player._team.ActivePlayers.OrderBy(plyr => _rand.Next(0, 200)); foreach (Player p in teamPlayers) { if (p.IsDead) { continue; } if (p == player) { continue; } if (inPlayers.ContainsKey(p)) { continue; } inPlayers.Add(p, true); if (p._team == team1) { team1Count++; } else { team2Count++; } _arena.triggerMessage(5, 500, String.Format("{0} caught a ball and returned {1} to the court.", player._alias, p._alias)); player.setVar("Catches", player.getVarInt("Catches") + 1); player.Cash += 800; player.sendMessage(0, "Catch award: (Cash=800)"); p.warp(player._state.positionX + _rand.Next(0, 15), player._state.positionY + _rand.Next(0, 15)); break; } //Log.write(TLog.Warning, "Player catch {0}", player); //Run the damage event return(false); } //Stop the damage event from being run return(true); }
public bool playerExplosion(Player from, ItemInfo.Projectile usedWep, short posX, short posY, short posZ) { if (gameState != GameState.ActiveGame) { return(true); } if (killStreaks.ContainsKey(from._alias)) { if (explosives.ContainsKey(usedWep.name)) { UpdateWeapon(from, usedWep, explosives[usedWep.name]); } } return(true); }
/// <summary> /// Handles damage from explosions triggered nearby /// </summary> public override void applyExplosion(Player attacker, int dmgX, int dmgY, ItemInfo.Projectile wep) { //Apply our damage applyExplosionDamage(false, attacker, dmgX, dmgY, wep); //Did we die? if (_state.health <= 0) { //Are we destroyable? if (_type.Destroyable == 0) { //We arent, set health to 0 _state.health = 0; } else { //Computer vehicles don't linger, so destroy it kill(null); } } _sendUpdate = true; }
public void playerExplosion(Player player, ItemInfo.Projectile weapon, short posX, short posY, short posZ) { switch (weapon.id) { //Supply Drop? case 1325: { Helpers.ObjectState spawn = new Helpers.ObjectState(); spawn.positionX = posX; spawn.positionY = posY; Vehicle marker = _arena.newVehicle(AssetManager.Manager.getVehicleByID(406), _team, null, spawn); if (marker != null) { _arena.sendArenaMessage(String.Format("&Air Support inbound to your coordinates ({0}), Sit tight Soldiers!", Helpers.posToLetterCoord(marker._state.positionX, marker._state.positionY)), 4); spawnGunship(player._team, marker, player); } } break; } }
/// <summary> /// Equips the weapon controller with a new item /// </summary> public bool equip(ItemInfo item) { _type = item; //Find our primary weapon AssetManager am = Helpers._server._assets; _primaryItem = item; _primaryItem.getAmmoType(out _ammoType, out _ammoCount, out _ammoCapacity); _ammoRemaining = _ammoCapacity; //What sort of item are we dealing with? if (_primaryItem is ItemInfo.MultiUse) { ItemInfo.MultiUse mug = (ItemInfo.MultiUse)_primaryItem; _reloadTime = mug.reloadDelayNormal * 10; _fireDelay = mug.fireDelay * 10; //Assume the first item is the tracking projectile _primaryProjectile = ((ItemInfo.Projectile)am.getItemByID(mug.childItems[0].id)); } else if (_primaryItem is ItemInfo.Projectile) { _primaryProjectile = (ItemInfo.Projectile)_primaryItem; _reloadTime = _primaryProjectile.reloadDelayNormal * 10; _fireDelay = _primaryProjectile.fireDelay * 10; } else { //We can't handle this item Log.write(TLog.Warning, "Weapon controller given invalid equip item {0}", item); return(false); } bEquipped = (_primaryProjectile != null); return(true); }
public void playerExplosion(Player player, ItemInfo.Projectile weapon, short posX, short posY, short posZ) { }
public bool playerExplosion(Player player, ItemInfo.Projectile weapon, short posX, short posY, short posZ) { //Log.write(TLog.Warning, "Explosion: X={0}, Y={1}, Z={2}, Wep={3}, Player={4}", posX, posY, posZ, weapon.id, player); return(true); }
public bool playerExplosion(Player player, ItemInfo.Projectile weapon, short posX, short posY, short posZ) { return(true); }
/// <summary> /// Handles damage from explosions triggered nearby /// </summary> public override void applyExplosion(Player attacker, int dmgX, int dmgY, ItemInfo.Projectile wep) { //Apply our damage applyExplosionDamage(true, attacker, dmgX, dmgY, wep); }
public bool playerExplosion(Player player, ItemInfo.Projectile weapon, short posX, short posY, short posZ) { //1224 = flip proj. 307 = titan dart. 308 = collective dart if (weapon.id == 1224 && player._occupiedVehicle != null) { //Stores the id of the vehicle the player is in ushort occupiedVehicleId = (ushort)player._occupiedVehicle._type.Id; //Make a new vehicle of the same type as the one the player is in Vehicle skin = _arena.newVehicle(occupiedVehicleId); //Orientate the new vehicle to the player's positional state orientateTo(skin, player); //Flip the vehicle skin._state.yaw += 45; //Make a note of old vehicle's health player.setVar("healthDecay", player._occupiedVehicle._type.Hitpoints - player._occupiedVehicle._state.health); //Destroy current occupied vehicle player._occupiedVehicle.destroy(true); //Enter the new vehicle skin.playerEnter(player); //Reapply old health player.inventoryModify(AssetManager.Manager.getItemByName("MinusHealth"), player.getVarInt("healthDecay")); } //If the player is in a titan droid (id = 324) and morph weapon used if (weapon.id == 1179 && player._occupiedVehicle._type.Id == 324) { //Make new vehicle (titan droid shielded) id=315 Vehicle skin = _arena.newVehicle(315); //Orientate the vehicle to the player's positional state orientateTo(skin, player); //Make a note of his health (because when you change him to another vehicle, he inherits the max hp of the new vehicle) player.setVar("healthDecay", player._occupiedVehicle._type.Hitpoints - player._occupiedVehicle._state.health); //Destroy current occupied vehicle player._occupiedVehicle.destroy(true); //Enter new vehicle (titan shielded droid) skin.playerEnter(player); //Reapply health loss player.inventoryModify(AssetManager.Manager.getItemByName("MinusHealth"), player.getVarInt("healthDecay")); } //If the player is in a morphed droid (id = 315) and unmorph weapon used else if (weapon.id == 1181 && player._occupiedVehicle._type.Id == 315) { //Return him to this world! //Make new vehicle (titan droid) Vehicle skin = _arena.newVehicle(324); //Orientate the vehicle to the player's positional state orientateTo(skin, player); //Make note of vehicle's health lost player.setVar("healthDecay", player._occupiedVehicle._type.Hitpoints - player._occupiedVehicle._state.health); //Destroy current occupied vehicle player._occupiedVehicle.destroy(true); //Enter new vehicle (original titan droid) skin.playerEnter(player); //Reapply health loss player.inventoryModify(AssetManager.Manager.getItemByName("MinusHealth"), player.getVarInt("healthDecay")); } //If the vehicle is a collective droid (id = 311) and morph weapon used else if (weapon.id == 1179 && player._occupiedVehicle._type.Id == 311) { //Make new vehicle (collective droid shielded) with player's position id=302 Vehicle skin = _arena.newVehicle(302); //Orientate the vehicle to the player's positional state orientateTo(skin, player); //Make note of vehicle's health lost player.setVar("healthDecay", player._occupiedVehicle._type.Hitpoints - player._occupiedVehicle._state.health); //Destroy current occupied vehicle player._occupiedVehicle.destroy(true); //Enter new vehicle (collective droid shielded) skin.playerEnter(player); //Reapply health loss player.inventoryModify(AssetManager.Manager.getItemByName("MinusHealth"), player.getVarInt("healthDecay")); } //If the vehicle is a morphed droid (id = 302) and unmorphed weapon used else if (weapon.id == 1179 && player._occupiedVehicle._type.Id == 302) { //Make new vehicle (collective droid) with player's position Vehicle skin = _arena.newVehicle(311); //Orientate the vehicle to the player's positional state orientateTo(skin, player); //Make note of vehicle's health lost player.setVar("healthDecay", player._occupiedVehicle._type.Hitpoints - player._occupiedVehicle._state.health); //Destroy current occupied vehicle player._occupiedVehicle.destroy(true); //Enter new vehicle (collective droid) skin.playerEnter(player); //Reapply health loss player.inventoryModify(AssetManager.Manager.getItemByName("MinusHealth"), player.getVarInt("healthDecay")); } return(true); }
public bool playerDamageEvent(Player player, ItemInfo.Projectile weapon, short posX, short posY, short posZ) { return(true); }
/// <summary> /// Calculates how much damage the vehicle should receive from an explosion /// </summary> public void applyExplosionDamage(bool bImpliedExplosion, Player attacker, int dmgX, int dmgY, ItemInfo.Projectile wep) { //Quick check to make sure that the weapon is even damaging before we do math int maxRadius = Helpers.getMaxBlastRadius(wep); if (maxRadius == 0) { return; } //Will this weapon even harm us? if (attacker != null) { switch (wep.damageMode) { case 2: //Enemy if (attacker._team == _team) { return; } break; case 3: //Friendly but self if (attacker._team != _team) { return; } break; case 4: //Friendly if (attacker._team != _team) { return; } break; } } //Find the radius at which we were closest to the blast double radius = getImpliedRadius(dmgX, dmgY, maxRadius + _type.TriggerRadius); radius -= _type.TriggerRadius; if (radius < 1) { radius = 1; } //Calculate the damage for each type double fraction = 0; double grossDamage = 0; double netDamage = 0; if (radius <= wep.kineticDamageRadius) { fraction = 1 - radius / wep.kineticDamageRadius; grossDamage = (wep.kineticDamageInner - wep.kineticDamageOuter) * fraction + wep.kineticDamageOuter; netDamage += (grossDamage - _type.Armors[0].SelfIgnore) * (1.0d - _type.Armors[0].SelfReduction / 1000.0d); } if (radius <= wep.explosiveDamageRadius) { fraction = 1 - radius / wep.explosiveDamageRadius; grossDamage = (wep.explosiveDamageInner - wep.explosiveDamageOuter) * fraction + wep.explosiveDamageOuter; netDamage += (grossDamage - _type.Armors[1].SelfIgnore) * (1.0d - _type.Armors[1].SelfReduction / 1000.0d); } if (radius <= wep.electronicDamageRadius) { fraction = 1 - radius / wep.electronicDamageRadius; grossDamage = (wep.electronicDamageInner - wep.electronicDamageOuter) * fraction + wep.electronicDamageOuter; netDamage += (grossDamage - _type.Armors[2].SelfIgnore) * (1.0d - _type.Armors[2].SelfReduction / 1000.0d); } if (radius <= wep.psionicDamageRadius) { fraction = 1 - radius / wep.psionicDamageRadius; grossDamage = (wep.psionicDamageInner - wep.psionicDamageOuter) * fraction + wep.psionicDamageOuter; netDamage += (grossDamage - _type.Armors[3].SelfIgnore) * (1.0d - _type.Armors[3].SelfReduction / 1000.0d); } if (radius <= wep.bypassDamageRadius) { fraction = 1 - radius / wep.bypassDamageRadius; grossDamage = (wep.bypassDamageInner - wep.bypassDamageOuter) * fraction + wep.bypassDamageOuter; netDamage += (grossDamage - _type.Armors[4].SelfIgnore) * (1.0d - _type.Armors[4].SelfReduction / 1000.0d); } if (radius <= wep.energyDamageRadius) { /*fraction = 1 - radius / wep.energyDamageRadius; * grossDamage = (wep.energyDamageInner - wep.energyDamageOuter) * fraction + wep.energyDamageOuter; * netDamage += (grossDamage - _type.Armors[5].SelfIgnore) * (1.0d - _type.Armors[5].SelfReduction / 1000.0d);*/ // if (netDamage > 0) // TODO: take care of energy damage } //anti effects if (radius <= wep.antiEffectsRadius) { if (wep.antiEffectsFire > 0) { _tickAntiFire = Environment.TickCount + (wep.antiEffectsFire * 10); } if (wep.antiEffectsRecharge > 0) { _tickAntiRecharge = Environment.TickCount + (wep.antiEffectsRecharge * 10); } if (wep.antiEffectsRotate > 0) { _tickAntiRotate = Environment.TickCount + (wep.antiEffectsRotate * 10); } } //Apply the damage if (netDamage > 0) { _state.health -= (short)Math.Round((netDamage / 1000)); if (attacker != null) { if (!_attackers.Contains(attacker)) { _attackers.Add(attacker); } } } //Have we been killed? if (_state.health <= 0) { if (attacker != null) { kill(attacker, wep.id); } else { kill(null, wep.id); } _state.health = 0; } }
/// <summary> /// Handles damage from explosions triggered nearby /// </summary> public virtual void applyExplosion(Player attacker, int dmgX, int dmgY, ItemInfo.Projectile wep) { }
public bool playerExplosion(Player player, ItemInfo.Projectile weapon, short posX, short posY, short posZ) { //If the player is in a titan droid (id = 111) and morph weapon used if (weapon.id == 1179 && player._occupiedVehicle._type.Id == 111) { //TODO: skin.orientateTo(player); function... //Make new vehicle (titan droid shielded) Vehicle skin = _arena.newVehicle(113); //Orientate the vehicle to the player's positional state orientateTo(skin, player); //skin._state.positionX = player._state.positionX; //skin._state.positionY = player._state.positionY; //skin._state.yaw = player._state.yaw; //Make a note of his health (because when you change him to another vehicle, he inherits the max hp of the new vehicle) player.setVar("healthDecay", player._occupiedVehicle._type.Hitpoints - player._occupiedVehicle._state.health); //Destroy current occupied vehicle player._occupiedVehicle.destroy(true); //Enter new vehicle (titan shielded droid) skin.playerEnter(player); //Reapply health loss player.inventoryModify(AssetManager.Manager.getItemByName("MinusHealth"), player.getVarInt("healthDecay")); } //If the player is in a morphed droid (id = 113) and unmorph weapon used else if (weapon.id == 1181 && player._occupiedVehicle._type.Id == 113) { //Return him to this world! //Make new vehicle (titan droid) Vehicle skin = _arena.newVehicle(111); //Orientate the vehicle to the player's positional state orientateTo(skin, player); //skin._state.positionX = player._state.positionX; //skin._state.positionY = player._state.positionY; //skin._state.yaw = player._state.yaw; //Make note of vehicle's health lost player.setVar("healthDecay", player._occupiedVehicle._type.Hitpoints - player._occupiedVehicle._state.health); //Destroy current occupied vehicle player._occupiedVehicle.destroy(true); //Enter new vehicle (original titan droid) skin.playerEnter(player); //Reapply health loss player.inventoryModify(AssetManager.Manager.getItemByName("MinusHealth"), player.getVarInt("healthDecay")); } //If the vehicle is a collective droid (id = 211) and morph weapon used else if (weapon.id == 1179 && player._occupiedVehicle._type.Id == 211) { //Make new vehicle (collective droid shielded) with player's position Vehicle skin = _arena.newVehicle(213); //Orientate the vehicle to the player's positional state orientateTo(skin, player); //skin._state.positionX = player._state.positionX; //skin._state.positionY = player._state.positionY; //skin._state.yaw = player._state.yaw; //Make note of vehicle's health lost player.setVar("healthDecay", player._occupiedVehicle._type.Hitpoints - player._occupiedVehicle._state.health); //Destroy current occupied vehicle player._occupiedVehicle.destroy(true); //Enter new vehicle (collective droid shielded) skin.playerEnter(player); //Reapply health loss player.inventoryModify(AssetManager.Manager.getItemByName("MinusHealth"), player.getVarInt("healthDecay")); } //If the vehicle is a morphed droid (id = 213) and unmorphed weapon used else if (weapon.id == 1179 && player._occupiedVehicle._type.Id == 213) { //Make new vehicle (collective droid) with player's position Vehicle skin = _arena.newVehicle(211); //Orientate the vehicle to the player's positional state orientateTo(skin, player); //skin._state.positionX = player._state.positionX; //skin._state.positionY = player._state.positionY; //skin._state.yaw = player._state.yaw; //Make note of vehicle's health lost player.setVar("healthDecay", player._occupiedVehicle._type.Hitpoints - player._occupiedVehicle._state.health); //Destroy current occupied vehicle player._occupiedVehicle.destroy(true); //Enter new vehicle (collective droid) skin.playerEnter(player); //Reapply health loss player.inventoryModify(AssetManager.Manager.getItemByName("MinusHealth"), player.getVarInt("healthDecay")); } return(true); }
public bool playerExplosion(Player from, ItemInfo.Projectile usedWep, short posX, short posY, short posZ) { _gamePlay.playerPlayerExplosion(from, usedWep); return(true); }