當前位置: 首頁>>代碼示例>>C#>>正文


C# NPCEntry.GetRandomMana方法代碼示例

本文整理匯總了C#中WCell.RealmServer.NPCs.NPCEntry.GetRandomMana方法的典型用法代碼示例。如果您正苦於以下問題:C# NPCEntry.GetRandomMana方法的具體用法?C# NPCEntry.GetRandomMana怎麽用?C# NPCEntry.GetRandomMana使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在WCell.RealmServer.NPCs.NPCEntry的用法示例。


在下文中一共展示了NPCEntry.GetRandomMana方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: SetupNPC

		protected internal virtual void SetupNPC(NPCEntry entry, SpawnPoint spawnPoint)
		{
			// auras
			m_auras = new NPCAuraCollection(this);

			SpawnEntry spawnEntry;
			if (spawnPoint != null)
			{
				// Spawn-specific information
				spawnEntry = spawnPoint.SpawnEntry;
				m_spawnPoint = spawnPoint;
				Phase = spawnEntry.PhaseMask;
				m_orientation = spawnEntry.Orientation;

				if (spawnEntry.DisplayIdOverride != 0)
				{
					DisplayId = spawnEntry.DisplayIdOverride;
				}
				else if (entry.ModelInfos != null && entry.ModelInfos.Length > 0)
				{
					Model = entry.ModelInfos.GetRandom();
				}
			}
			else
			{
				Phase = 1;
				spawnEntry = entry.FirstSpawnEntry;
			}

			Entry = entry;
			NativeDisplayId = DisplayId;

			// misc stuff
			Faction = entry.Faction;
			NPCFlags = entry.NPCFlags;
			UnitFlags = entry.UnitFlags;
			DynamicFlags = entry.DynamicFlags;
			Class = entry.ClassId;
			Race = entry.RaceId;
			YieldsXpOrHonor = entry.GeneratesXp;
			SheathType = SheathType.Melee;

			// speeds
			m_runSpeed = entry.RunSpeed;
			m_swimSpeed = entry.RunSpeed;
			m_swimBackSpeed = entry.RunSpeed;
			m_walkSpeed = entry.WalkSpeed;
			m_walkBackSpeed = entry.WalkSpeed;
			m_flightSpeed = entry.FlySpeed;
			m_flightBackSpeed = entry.FlySpeed;

			Array.Copy(entry.Resistances, m_baseResistances, m_baseResistances.Length);

			MainWeapon = m_entry.CreateMainHandWeapon();
			RangedWeapon = m_entry.CreateRangedWeapon();
			OffHandWeapon = entry.CreateOffhandWeapon();

			// Set model after Scale
			Model = m_entry.GetRandomModel();

			GossipMenu = entry.DefaultGossip; // set gossip menu

			// TODO: Init stats
			//for (int i = 0; i < 5; i++)
			//{
			//    m_baseStats[i] = statVal;
			//}
			PowerType = PowerType.Mana;
			SetBaseStat(StatType.Strength, 1, false);
			SetBaseStat(StatType.Agility, 1, false);
			SetBaseStat(StatType.Intellect, 1, false);
			SetBaseStat(StatType.Stamina, 1, false);
			SetBaseStat(StatType.Spirit, 1, false);

			// health + power
			var health = entry.GetRandomHealth();
			SetUInt32(UnitFields.MAXHEALTH, health);
			SetUInt32(UnitFields.BASE_HEALTH, health);

			if (spawnEntry == null || !spawnEntry.IsDead)
			{
				SetUInt32(UnitFields.HEALTH, health);
			}

			var mana = entry.GetRandomMana();
			SetInt32(UnitFields.MAXPOWER1, mana);
			SetInt32(UnitFields.BASE_MANA, mana);
			SetInt32(UnitFields.POWER1, mana);

			HoverHeight = entry.HoverHeight;

			m_Movement = new Movement(this);

			PowerCostMultiplier = 1f;

			if (PowerType == PowerType.Mana)
			{
				ManaRegenPerTickInterruptedPct = 20;
			}

//.........這裏部分代碼省略.........
開發者ID:enjoii,項目名稱:WCell,代碼行數:101,代碼來源:NPC.cs

示例2: SetEntry

        public void SetEntry(NPCEntry entry)
        {
            Entry = entry;

            if (m_spawnPoint == null || m_spawnPoint.SpawnEntry.DisplayIdOverride == 0)
            {
                if (entry.ModelInfos.Length > 0)
                {
                    Model = entry.ModelInfos.GetRandom();
                }
            }
            NativeDisplayId = DisplayId;

            if (m_brain == null)
            {
                // new brain
                m_brain = m_entry.BrainCreator(this);
                m_brain.IsRunning = true;
            }

            if (m_Movement == null)
            {
                m_Movement = new Movement(this);
            }

            // misc stuff
            Name = m_entry.DefaultName;
            NPCFlags = entry.NPCFlags;
            UnitFlags = entry.UnitFlags;
            DynamicFlags = entry.DynamicFlags;
            Class = entry.ClassId;
            Race = entry.RaceId;
            YieldsXpOrHonor = entry.GeneratesXp;
            SheathType = SheathType.Melee;

            // decide which faction
            if (m_spawnPoint != null)
            {
                var map = m_spawnPoint.Map;
                if (map != null)
                {
                    Faction = DefaultFaction;
                }
            }
            if (Faction == null)
            {
                Faction = entry.RandomFaction;
            }

            // speeds
            m_runSpeed = entry.RunSpeed;
            m_swimSpeed = entry.RunSpeed;
            m_swimBackSpeed = entry.RunSpeed;
            m_walkSpeed = entry.WalkSpeed;
            m_walkBackSpeed = entry.WalkSpeed;
            m_flightSpeed = entry.FlySpeed;
            m_flightBackSpeed = entry.FlySpeed;

            Array.Copy(entry.Resistances, m_baseResistances, m_baseResistances.Length);

            MainWeapon = m_entry.CreateMainHandWeapon();
            RangedWeapon = m_entry.CreateRangedWeapon();
            OffHandWeapon = entry.CreateOffhandWeapon();

            // Set model after Scale
            Model = m_entry.GetRandomModel();

            GossipMenu = entry.DefaultGossip; // set gossip menu

            // TODO: Init stats
            //for (int i = 0; i < 5; i++)
            //{
            //    m_baseStats[i] = statVal;
            //}
            PowerType = PowerType.Mana;
            SetBaseStat(StatType.Strength, 1, false);
            SetBaseStat(StatType.Agility, 1, false);
            SetBaseStat(StatType.Intellect, 1, false);
            SetBaseStat(StatType.Stamina, 1, false);
            SetBaseStat(StatType.Spirit, 1, false);

            // health + power
            var health = entry.GetRandomHealth();
            SetInt32(UnitFields.MAXHEALTH, health);
            SetInt32(UnitFields.BASE_HEALTH, health);

            if (m_entry.IsDead || m_spawnPoint == null || !m_spawnPoint.SpawnEntry.IsDead)
            {
                SetInt32(UnitFields.HEALTH, health);
            }
            else if (m_entry.Regenerates)
            {
                Regenerates = true;
                HealthRegenPerTickNoCombat = Math.Max(m_entry.MaxHealth / 10, 1);
            }

            var mana = entry.GetRandomMana();
            if (mana == 0)
            {
                SetInt32(UnitFields.MAXPOWER1, 1);
//.........這裏部分代碼省略.........
開發者ID:ebakkedahl,項目名稱:WCell,代碼行數:101,代碼來源:NPC.cs

示例3: SetupNPC

		protected internal virtual void SetupNPC(NPCEntry entry, SpawnPoint spawnPoint)
		{
			// auras
			m_auras = new NPCAuraCollection(this);

			var mainWeapon = entry.CreateMainHandWeapon();

			SpawnEntry spawnEntry;
			if (spawnPoint != null)
			{
				// Spawn-specific information
				spawnEntry = spawnPoint.SpawnEntry;
				m_spawnPoint = spawnPoint;
				Phase = spawnEntry.PhaseMask;
				m_orientation = spawnEntry.Orientation;
				if (spawnEntry.MountId != 0)
				{
					Mount(spawnEntry.MountId);
				}

				if (spawnEntry.DisplayIdOverride != 0)
				{
					DisplayId = spawnEntry.DisplayIdOverride;
				}

				SetUInt32(UnitFields.BYTES_0, spawnEntry.Bytes);
				SetUInt32(UnitFields.BYTES_2, spawnEntry.Bytes2);
			}
			else
			{
				Phase = 1;
				spawnEntry = entry.FirstSpawnEntry;
			}

			EmoteState = (spawnEntry != null && spawnEntry.EmoteState != 0) ? spawnEntry.EmoteState : entry.EmoteState;
			Entry = entry;
			NativeDisplayId = DisplayId;

			// misc stuff
			Faction = entry.Faction;
			NPCFlags = entry.NPCFlags;
			UnitFlags = entry.UnitFlags;
			DynamicFlags = entry.DynamicFlags;
			Class = entry.ClassId;
			Race = entry.RaceId;
			YieldsXpOrHonor = entry.GeneratesXp;
			SheathType = SheathType.Melee;

			// speeds
			m_runSpeed = entry.RunSpeed;
			m_swimSpeed = entry.RunSpeed;
			m_swimBackSpeed = entry.RunSpeed;
			m_walkSpeed = entry.WalkSpeed;
			m_walkBackSpeed = entry.WalkSpeed;
			m_flightSpeed = entry.FlySpeed;
			m_flightBackSpeed = entry.FlySpeed;

			Array.Copy(entry.Resistances, m_baseResistances, m_baseResistances.Length);

			MainWeapon = mainWeapon;

			// Set Level/Scale *after* MainWeapon is set:
			var level = entry.GetRandomLevel();
			Level = level;

			// Set model after Scale
			Model = m_entry.GetRandomModel();

			m_gossipMenu = entry.DefaultGossip; // set gossip menu

			// TODO: Init stats
			//for (int i = 0; i < 5; i++)
			//{
			//    m_baseStats[i] = statVal;
			//}
			PowerType = PowerType.Mana;
			SetBaseStat(StatType.Strength, 1, false);
			SetBaseStat(StatType.Agility, 1, false);
			SetBaseStat(StatType.Intellect, 1, false);
			SetBaseStat(StatType.Stamina, 1, false);
			SetBaseStat(StatType.Spirit, 1, false);

			// health + power
			var health = entry.GetRandomHealth();
			SetUInt32(UnitFields.MAXHEALTH, health);
			SetUInt32(UnitFields.BASE_HEALTH, health);

			if (spawnEntry == null || !spawnEntry.IsDead)
			{
				SetUInt32(UnitFields.HEALTH, health);
			}

			var mana = entry.GetRandomMana();
			SetInt32(UnitFields.MAXPOWER1, mana);
			SetInt32(UnitFields.BASE_MANA, mana);
			SetInt32(UnitFields.POWER1, mana);

			OffHandWeapon = entry.CreateOffhandWeapon();
			RangedWeapon = entry.CreateRangedWeapon();

//.........這裏部分代碼省略.........
開發者ID:WCellFR,項目名稱:WCellFR,代碼行數:101,代碼來源:NPC.cs


注:本文中的WCell.RealmServer.NPCs.NPCEntry.GetRandomMana方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。