private static void LoadWeaponInfo() { foreach (var item in weaponSheet) { if (item._code == null) { continue; } item.hitClass = WeaponHitClass.Find(item._hitClass); item.missileType = MissileInfo.Find(item.missileTypeId); item.code = item._code; item.cost = item._cost; item.gambleCost = item._gambleCost; item.flippyFile = item._flippyFile; item.invFile = item._invFile; item.invWidth = item._invWidth; item.invHeight = item._invHeight; item.level = item._level; item.levelReq = item._levelReq; item.weapon = item; item.name = Translation.Find(item.nameStr); item.type1Code = item._type1; item.type2Code = item._type2; item.component = item._component; item.alternateGfx = item._alternateGfx; item.dropSound = SoundInfo.Find(item._dropSound); item.dropSoundFrame = item._dropSoundFrame; item.useSound = SoundInfo.Find(item._useSound); item.alwaysUnique = item._alwaysUnique; item.normCode = item._normCode; item.uberCode = item._uberCode; item.ultraCode = item._ultraCode; if (!byCode.ContainsKey(item.code)) { byCode.Add(item.code, item); } } }
public void Do(Unit self, Unit targetUnit, Vector3 target) { if (srvDoFunc == 27) { // teleport self.InstantMove(target); } if (srvDoFunc == 1) { Item weapon = self.equip == null ? null : self.equip.GetWeapon(); int damage = 10; WeaponHitClass hitClass = WeaponHitClass.HandToHand; bool ranged = false; if (weapon != null) { WeaponInfo weaponInfo = weapon.info.weapon; hitClass = weaponInfo.hitClass; if (weaponInfo.twoHanded) { damage = Random.Range(weaponInfo.twoHandedMinDamage, weaponInfo.twoHandedMaxDamage + 1); } else { damage = Random.Range(weaponInfo.minDamage, weaponInfo.maxDamage + 1); } ranged = weapon.info.type.shoots != null; } if (ranged) { var missile = Missile.Create("arrow", target, self); missile.weaponDamage = damage; } else if (targetUnit != null && IsRangeOk(self, targetUnit, target)) { AudioManager.instance.Play(hitClass.hitSound, targetUnit.transform.position); targetUnit.Hit(damage, self); } } else if (srvDoFunc == 17) { // charged bold, bolt sentry int boltCount = 7; for (int i = 0; i < boltCount; ++i) { var offset = new Vector3(Random.Range(-boltCount / 2f, boltCount / 2f), Random.Range(-boltCount / 2f, boltCount / 2f)); Missile.Create(clientMissileA, self.iso.pos, target + offset, self); } } else if (srvDoFunc == 22) { // nova, poison nova, howl int missileCount = 64; Missile.CreateRadially(clientMissileA, self.iso.pos, self, missileCount); } else if (srvDoFunc == 31) { // raise skeleton, raise skeletal mage var pos = Iso.MapToWorld(target); var monster = global::Diablerie.Game.World.WorldBuilder.SpawnMonster(summon, pos, summoner: self); monster.overrideMode = summode; Missile.Create(clientMissileA, target, target, self); } else if (srvDoFunc == 45) { // traps var pos = Iso.MapToWorld(target); var monster = global::Diablerie.Game.World.WorldBuilder.SpawnMonster(summon, pos, summoner: self); monster.overrideMode = summode; Missile.Create(clientMissileA, target, target, self); } else if (srvDoFunc == 56 || srvDoFunc == 57) { // 57 iron golem, 56 other golems var pos = Iso.MapToWorld(target); var monster = global::Diablerie.Game.World.WorldBuilder.SpawnMonster(summon, pos, summoner: self); monster.overrideMode = summode; } else if (srvDoFunc == 114) { // raven var pos = Iso.MapToWorld(target); var monster = global::Diablerie.Game.World.WorldBuilder.SpawnMonster(summon, pos, summoner: self); monster.overrideMode = summode; } else if (srvDoFunc == 119) { // summon grizzly, wolves, spirits var pos = Iso.MapToWorld(target); var monster = global::Diablerie.Game.World.WorldBuilder.SpawnMonster(summon, pos, summoner: self); monster.overrideMode = summode; } else if (srvDoFunc == 68) { // barbarian howls int missileCount = 64; Missile.CreateRadially(clientMissileA, self.iso.pos, self, missileCount); } else { if (clientMissileA != null) { Missile.Create(clientMissileA, self.iso.pos, target, self); } } if (clientMissile != null) { Missile.Create(clientMissile, self.iso.pos, target, self); } }
static WeaponHitClass() { map.Add("hth", new WeaponHitClass() { sound = SoundInfo.Find("weapon_punch_1"), hitSound = SoundInfo.Find("impact_punch_1") }); map.Add("1hss", new WeaponHitClass() { sound = SoundInfo.Find("weapon_1hs_small_1"), hitSound = SoundInfo.Find("impact_blade_swing_1") }); map.Add("1hsl", new WeaponHitClass() { sound = SoundInfo.Find("weapon_1hs_large_1"), hitSound = SoundInfo.Find("impact_blade_swing_1") }); map.Add("2hss", new WeaponHitClass() { sound = SoundInfo.Find("weapon_2hs_small_1"), hitSound = SoundInfo.Find("impact_blade_swing_1") }); map.Add("2hsl", new WeaponHitClass() { sound = SoundInfo.Find("weapon_2hs_large_1"), hitSound = SoundInfo.Find("impact_blade_swing_1") }); map.Add("1ht", new WeaponHitClass() { sound = SoundInfo.Find("weapon_1ht_1"), hitSound = SoundInfo.Find("impact_blade_thrust_1") }); map.Add("2ht", new WeaponHitClass() { sound = SoundInfo.Find("weapon_2ht_1"), hitSound = SoundInfo.Find("impact_blade_thrust_1") }); map.Add("club", new WeaponHitClass() { sound = SoundInfo.Find("weapon_1ht_1"), hitSound = SoundInfo.Find("impact_blunt_1") }); map.Add("staf", new WeaponHitClass() { sound = SoundInfo.Find("weapon_staff_1"), hitSound = SoundInfo.Find("impact_blunt_1") }); map.Add("bow", new WeaponHitClass() { sound = null, hitSound = null }); map.Add("xbow", new WeaponHitClass() { sound = null, hitSound = null }); map.Add("claw", new WeaponHitClass() { sound = SoundInfo.Find("weapon_punch_1"), hitSound = SoundInfo.Find("impact_claw_1") }); foreach (var kv in map) { kv.Value.code = kv.Key; } HandToHand = map["hth"]; }