コード例 #1
0
        private static void CreateCustomEntry(NPCId npcId, NpcCustomEntryId customEntryId, float healthMod,
                                              float otherStatsMod, int maxLevel, float speedMod,
                                              NpcCustomEntrySettings npcCustomEntrySettings, bool isAggressive = true)
        {
            NPCEntry entry = NPCMgr.GetEntry(npcId).Clone();

            entry.SetLevel(maxLevel - 5);
            if (npcCustomEntrySettings.Health.HasValue)
            {
                entry.SetHealth((int)(npcCustomEntrySettings.Health.Value * (double)healthMod));
            }
            if (npcCustomEntrySettings.PDef.HasValue)
            {
                entry.Resistances[0] = (int)(npcCustomEntrySettings.PDef.Value * (double)otherStatsMod);
            }
            if (npcCustomEntrySettings.MDef.HasValue)
            {
                entry.Resistances[1] = (int)(npcCustomEntrySettings.MDef.Value * (double)otherStatsMod);
            }
            if (npcCustomEntrySettings.Damage.HasValue)
            {
                entry.MinDamage = npcCustomEntrySettings.Damage.Value * 0.9f * otherStatsMod;
                entry.MaxDamage = npcCustomEntrySettings.Damage.Value * 1.1f * otherStatsMod;
            }

            if (npcCustomEntrySettings.Speed.HasValue)
            {
                entry.RunSpeed  = npcCustomEntrySettings.Speed.Value * speedMod;
                entry.WalkSpeed = npcCustomEntrySettings.Speed.Value * speedMod;
            }

            entry.IsAgressive = isAggressive;
            NPCMgr.AddEntry((uint)customEntryId, entry);
            entry.NPCId = npcId;
        }
コード例 #2
0
        private static void CreateCustomEntry(NPCId npcId, NpcCustomEntryId customEntryId, float healthMod, float otherStatsMod, int maxLevel, float speedMod, NpcCustomEntrySettings npcCustomEntrySettings, bool isAggressive = true)
        {
            var entry = NPCMgr.GetEntry(npcId).Clone();

            entry.SetLevel(maxLevel - 5);
            if (npcCustomEntrySettings.Health != null)
            {
                entry.SetHealth((int)(npcCustomEntrySettings.Health.Value * healthMod));
            }
            if (npcCustomEntrySettings.PDef != null)
            {
                entry.Resistances[(int)DamageSchool.Physical] = (int)(npcCustomEntrySettings.PDef.Value * otherStatsMod);
            }
            if (npcCustomEntrySettings.MDef != null)
            {
                entry.Resistances[(int)DamageSchool.Magical] = (int)(npcCustomEntrySettings.MDef.Value * otherStatsMod);
            }
            if (npcCustomEntrySettings.Damage != null)
            {
                entry.MinDamage = npcCustomEntrySettings.Damage.Value * 0.9f * otherStatsMod;
                entry.MaxDamage = npcCustomEntrySettings.Damage.Value * 1.1f * otherStatsMod;
            }
            if (npcCustomEntrySettings.Speed != null)
            {
                entry.RunSpeed  = npcCustomEntrySettings.Speed.Value * speedMod;
                entry.WalkSpeed = npcCustomEntrySettings.Speed.Value * speedMod;
            }
            entry.IsAgressive = isAggressive;
            NPCMgr.AddEntry((uint)customEntryId, entry);
            entry.NPCId = npcId;
        }