Exemplo n.º 1
0
        private void OnUnitStartedSkill(Unit unit, SkillInfo skillInfo)
        {
            AudioManager.instance.Play(skillInfo.startSound, unit.transform);

            if (skillInfo == SkillInfo.Attack)
            {
                if (unit.monStat != null)
                {
                    AudioManager.instance.Play(unit.monStat.sound.weapon1, unit.transform,
                                               delay: unit.monStat.sound.weapon1Delay, volume: unit.monStat.sound.weapon1Volume);
                    AudioManager.instance.Play(unit.monStat.sound.attack1, unit.transform,
                                               delay: unit.monStat.sound.attack1Delay);
                }
                else
                {
                    Item           weapon   = unit.equip == null ? null : unit.equip.GetWeapon();
                    WeaponHitClass hitClass = WeaponHitClass.HandToHand;
                    if (weapon != null)
                    {
                        hitClass = weapon.info.weapon.hitClass;
                    }
                    AudioManager.instance.Play(hitClass.sound, unit.transform);
                }
            }
        }
Exemplo n.º 2
0
        void TryUseSkill()
        {
            if (_dead || _dying || _resurrecting || _usingSkill || _skillInfo == null || overrideMode != null)
            {
                return;
            }

            if (_targetCharacter != null)
            {
                _targetPoint = _targetCharacter.iso.pos;
            }

            bool ranged = _skillWeapon != null && _skillWeapon.info.type.shoots != null;

            if (ranged || _skillInfo.IsRangeOk(this, _targetCharacter, _targetPoint))
            {
                LookAtImmediately(_targetPoint);
                _usingSkill = true;
                _moving     = false;
                if (_skillInfo.castOverlay != null)
                {
                    // TODO set overlay speed to spell cast rate
                    Overlay.Create(gameObject, loop: false, overlayInfo: _skillInfo.castOverlay);
                }

                AudioManager.instance.Play(_skillInfo.startSound, transform);

                if (_skillInfo == SkillInfo.Attack)
                {
                    if (monStat != null)
                    {
                        AudioManager.instance.Play(monStat.sound.weapon1, transform,
                                                   delay: monStat.sound.weapon1Delay, volume: monStat.sound.weapon1Volume);
                        AudioManager.instance.Play(monStat.sound.attack1, transform,
                                                   delay: monStat.sound.attack1Delay);
                    }
                    else
                    {
                        Item           weapon   = equip == null ? null : equip.GetWeapon();
                        WeaponHitClass hitClass = WeaponHitClass.HandToHand;
                        if (weapon != null)
                        {
                            hitClass = weapon.info.weapon.hitClass;
                        }
                        AudioManager.instance.Play(hitClass.sound, transform);
                    }
                }
            }
            else
            {
                _moving = true;
            }
        }
Exemplo n.º 3
0
    void TryUseSkill()
    {
        if (takingDamage || dead || dying || ressurecting || usingSkill || skillInfo == null)
        {
            return;
        }

        if (targetCharacter != null)
        {
            targetPoint = targetCharacter.iso.pos;
        }

        bool ranged = skillWeapon != null && skillWeapon.info.type.shoots != null;

        if (ranged || skillInfo.IsRangeOk(this, targetCharacter, targetPoint))
        {
            LookAtImmidietly(targetPoint);
            usingSkill = true;
            moving     = false;
            if (skillInfo.castOverlay != null)
            {
                Overlay.Create(gameObject, skillInfo.castOverlay);
            }
            AudioManager.instance.Play(skillInfo.startSound, transform);

            if (skillInfo == SkillInfo.Attack)
            {
                if (monStat != null)
                {
                    AudioManager.instance.Play(monStat.sound.weapon1, transform,
                                               delay: monStat.sound.weapon1Delay, volume: monStat.sound.weapon1Volume);
                    AudioManager.instance.Play(monStat.sound.attack1, transform,
                                               delay: monStat.sound.attack1Delay);
                }
                else
                {
                    Item           weapon   = equip == null ? null : equip.GetWeapon();
                    WeaponHitClass hitClass = WeaponHitClass.HandToHand;
                    if (weapon != null)
                    {
                        hitClass = weapon.info.weapon.hitClass;
                    }
                    AudioManager.instance.Play(hitClass.sound, transform);
                }
            }
        }
        else
        {
            moving = true;
        }
    }
Exemplo n.º 4
0
    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);
            }
        }
    }
Exemplo n.º 5
0
    public void Do(Character self, Character targetCharacter, 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 (targetCharacter != null && IsRangeOk(self, targetCharacter, target))
            {
                AudioManager.instance.Play(hitClass.hitSound, targetCharacter.transform.position);
                targetCharacter.TakeDamage(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 (clientMissileA != null)
            {
                Missile.Create(clientMissileA, self.iso.pos, target, self);
            }
        }

        if (clientMissile != null)
        {
            Missile.Create(clientMissile, self.iso.pos, target, self);
        }
    }
Exemplo n.º 6
0
    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"];
    }
Exemplo n.º 7
0
    public void Do(Character self, Character targetCharacter, 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 (targetCharacter != null && IsRangeOk(self, targetCharacter, target))
            {
                AudioManager.instance.Play(hitClass.hitSound, targetCharacter.transform.position);
                targetCharacter.TakeDamage(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 = World.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 = World.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 = World.SpawnMonster(summon, pos, summoner: self);
            monster.overrideMode = summode;
        }
        else if (srvDoFunc == 114)
        {
            // raven
            var pos     = Iso.MapToWorld(target);
            var monster = World.SpawnMonster(summon, pos, summoner: self);
            monster.overrideMode = summode;
        }
        else if (srvDoFunc == 119)
        {
            // summon grizzly, wolves, spirits
            var pos     = Iso.MapToWorld(target);
            var monster = World.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);
        }
    }