本文整理匯總了C#中Server.Mobile.GetType方法的典型用法代碼示例。如果您正苦於以下問題:C# Mobile.GetType方法的具體用法?C# Mobile.GetType怎麽用?C# Mobile.GetType使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Server.Mobile
的用法示例。
在下文中一共展示了Mobile.GetType方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: GenerateLootItem
public override Tuple<Item[],int> GenerateLootItem( Mobile creature )
{
Type type = m_InstrumentTypes[Utility.Random(m_InstrumentTypes.Length)];
BaseInstrument instrument = Activator.CreateInstance( type ) as BaseInstrument;
if ( instrument == null )
throw new Exception( String.Format( "Type {0} is not BaseInstrument or could not be instantiated.", type ) );
int value = 50;
if ( m_SlayerChance > Utility.RandomDouble() )
{
if ( creature != null )
instrument.Slayer = SlayerGroup.GetLootSlayerType( creature.GetType() );
else
instrument.Slayer = BaseRunicTool.GetRandomSlayer();
value += 100;
}
if ( 0.08 > Utility.RandomDouble() ) // chance that this is low quality
{
instrument.Quality = InstrumentQuality.Low;
value -= 50;
}
return new Tuple<Item[], int>( new Item[]{ instrument }, value );
}
示例2: Slays
public bool Slays( Mobile m )
{
Type t = m.GetType();
for ( int i = 0; i < m_Types.Length; ++i )
if ( m_Types[i] == t )
return true;
return false;
}
示例3: OnHit
public void OnHit( Mobile defender )
{
if ( m_TargetType == null )
{
m_TargetType = defender.GetType();
// Odd but OSI recalculates when the target changes...
int chivalry = (int) m_Owner.Skills.Chivalry.Value;
m_DamageScalar = 10 + ( ( chivalry - 40 ) * 9 ) / 10;
DeltaEnemies();
UpdateBuffInfo();
}
}
示例4: OnHit
public override void OnHit( Mobile attacker, Mobile defender, double damageBonus )
{
bool bonus = false;
Type t = defender.GetType();
for( int i = 0; i < SlayerVs.Length; i++ )
{
if ( t == SlayerVs[i] )
{
bonus = true;
break;
}
}
if ( bonus )
base.OnHit( attacker, defender, damageBonus + 2.0 );
else
base.OnHit( attacker, defender, damageBonus );
}
示例5: IgnoreYoungProtection
public override bool IgnoreYoungProtection( Mobile from )
{
if ( Completed )
return false;
IngredientInfo info = IngredientInfo.Get( this.Ingredient );
Type fromType = from.GetType();
for ( int i = 0; i < info.Creatures.Length; i++ )
{
if ( fromType == info.Creatures[i] )
return true;
}
return false;
}
示例6: OnKill
public override void OnKill(Mobile killed, Mobile killer )
{
base.OnKill(killed, killer);
// supports ignoring XmlPoints challenges
if(m_ChallengeStatus)
{
m_ChallengeStatus = false;
return;
}
if(killed == null || killer == null || killer == killed) return;
// check for within guild kills and ignore them
if(SameGuild(killed,killer)) return;
// this calculates the base faction level that will be gained/lost based upon the fame of the killed mob
double value = (double)(killed.Fame/1000.0);
if(value <= 0) value = 1;
// calculates credits gained in a similar way
int cval = (int)(killed.Fame*m_CreditScale);
if(cval <= 0) cval = 1;
Credits += cval;
// prepare the group lists that will be checked for faction
ArrayList glist = null;
ArrayList dglist = null;
// check to see whether this mob type has already been hashed into a group list
if(GroupHash.Contains(killed.GetType()))
{
glist = (ArrayList)GroupHash[killed.GetType()];
}
else
{
// otherwise look it up the slow way and prepare a hash entry for it at the same time
// unless it is using dynamic faction
glist = new ArrayList();
foreach(Group g in KillGroups)
{
if(MatchType(g.Members, killed))
{
glist.Add(g);
}
}
GroupHash.Add(killed.GetType(),glist);
}
// have to look up dynamic factions the exhaustive way
// does this mob have dynamic faction assignments?
ArrayList list = XmlAttach.FindAttachments(XmlAttach.MobileAttachments, killed, typeof(XmlDynamicFaction));
if(list != null && list.Count > 0)
{
//if(XmlAttach.FindAttachment(XmlAttach.MobileAttachments, killed, typeof(XmlDynamicFaction)) != null)
//{
dglist = new ArrayList();
foreach(Group g in KillGroups)
{
if(DynamicMatchType(g.Members, killed))
{
dglist.Add(g);
}
}
}
ArrayList alist = new ArrayList();
if(glist != null && glist.Count > 0)
alist.Add(glist);
if(dglist != null && dglist.Count > 0)
alist.Add(dglist);
// go through this with static and dynamic factions
foreach(ArrayList al in alist)
{
foreach(Group g in al)
{
// tabulate the faction loss from target group allies
if(g.Allies != null && g.Allies.Length > 0)
{
for(int i = 0; i< g.Allies.Length;i++)
{
Group ally = g.Allies[i];
int facloss = 0;
try
{
facloss = (int)(value*g.AllyLoss[i]);
}
catch{}
if(facloss <= 0) facloss = 1;
int p = GetFactionLevel(ally.GroupType) - facloss;
SetFactionLevel(ally.GroupType, p);
if(verboseMobFactions)
killer.SendMessage("lost {0} faction {1}", ally.GroupType,facloss);
}
}
//.........這裏部分代碼省略.........
示例7: HandleKill
public static void HandleKill( PlayerMobile pm, Mobile mob )
{
MLQuestContext context = GetContext( pm );
if ( context == null )
return;
List<MLQuestInstance> instances = context.QuestInstances;
Type type = null;
for ( int i = instances.Count - 1; i >= 0; --i )
{
MLQuestInstance instance = instances[i];
if ( instance.ClaimReward )
continue;
/* A kill only counts for a single objective within a quest,
* but it can count for multiple quests. This is something not
* currently observable on OSI, so it is assumed behavior.
*/
foreach ( BaseObjectiveInstance objective in instance.Objectives )
{
if ( !objective.Expired && objective is KillObjectiveInstance )
{
KillObjectiveInstance kill = (KillObjectiveInstance)objective;
if ( type == null )
type = mob.GetType();
if ( kill.AddKill( mob, type ) )
{
kill.CheckComplete();
break;
}
}
}
}
}
示例8: Mutate
public Item Mutate(Mobile from, Item item)
{
if (item != null && !(item is BaseWand))
{
if (item is BaseWeapon && 1 > Utility.Random(100))
{
item.Delete();
item = new FireHorn();
return item;
}
if (item is BaseWeapon || item is BaseArmor || item is BaseJewel || item is BaseHat)
{
if (item is BaseWeapon)
{
var weapon = (BaseWeapon)item;
if (55 > Utility.Random(100))
{
weapon.AccuracyLevel = (WeaponAccuracyLevel)GetRandomOldBonus();
}
if (45 > Utility.Random(100))
{
int damageLevel = GetRandomOldBonus();
if (PseudoSeerStone.Instance != null && PseudoSeerStone.Instance._HighestDamageLevelSpawn < damageLevel)
{
if (damageLevel == 5 && PseudoSeerStone.ReplaceVanqWithSkillScrolls)
{
return PuzzleChest.CreateRandomSkillScroll();
}
int platAmount = PseudoSeerStone.PlatinumPerMissedDamageLevel *
(damageLevel - PseudoSeerStone.Instance._HighestDamageLevelSpawn);
if (platAmount > 0)
{
return (new Platinum(platAmount));
}
damageLevel = PseudoSeerStone.Instance._HighestDamageLevelSpawn;
}
weapon.DamageLevel = (WeaponDamageLevel)damageLevel;
}
if (25 > Utility.Random(100))
{
weapon.DurabilityLevel = (WeaponDurabilityLevel)GetRandomOldBonus();
}
if (5 > Utility.Random(100))
{
weapon.Slayer = SlayerName.Silver;
}
if (1 > Utility.Random(1000) ||
(weapon.AccuracyLevel == 0 && weapon.DamageLevel == 0 && weapon.DurabilityLevel == 0 &&
weapon.Slayer == SlayerName.None && 5 > Utility.Random(100)))
{
weapon.Slayer = from != null ? SlayerGroup.GetLootSlayerType(from.GetType()) : BaseRunicTool.GetRandomSlayer();
}
if (weapon.AccuracyLevel == 0 && weapon.DamageLevel == 0 && weapon.DurabilityLevel == 0 &&
weapon.Slayer == SlayerName.None)
{
weapon.Identified = true;
}
}
else if (item is BaseArmor)
{
var armor = (BaseArmor)item;
if (55 > Utility.Random(100))
{
armor.ProtectionLevel = (ArmorProtectionLevel)GetRandomOldBonus();
}
if (25 > Utility.Random(100))
{
armor.Durability = (ArmorDurabilityLevel)GetRandomOldBonus();
}
if (armor.ProtectionLevel == 0 && armor.Durability == 0)
{
armor.Identified = true;
}
}
}
else if (item is BaseInstrument)
{
SlayerName slayer = from == null || from.EraAOS
? BaseRunicTool.GetRandomSlayer()
: SlayerGroup.GetLootSlayerType(from.GetType());
var instr = (BaseInstrument)item;
instr.Quality = InstrumentQuality.Regular;
instr.Slayer = slayer;
}
else if (item is Spellbook) //Randomize spellbook
{
//.........這裏部分代碼省略.........
示例9: MatchType
private static bool MatchType( ArrayList array, Mobile m)
{
if(array == null || m == null) return false;
foreach( object o in array)
{
if(o is Type && ((Type)o == m.GetType() || ((Type)o).IsSubclassOf(m.GetType()))) return true;
}
return false;
}
示例10: GetSubLevelFor
public int GetSubLevelFor(Mobile m)
{
Type[][] types = ChampionSpawnInfo.GetInfo(m_Type).SpawnTypes;
Type t = m.GetType();
for (int i = 0; i < types.GetLength(0); i++)
{
Type[] individualTypes = types[i];
for (int j = 0; j < individualTypes.Length; j++)
{
if (t == individualTypes[j])
return i;
}
}
return -1;
}
示例11: GetBodyName
public static string GetBodyName( Mobile m )
{
Type t = m.GetType();
object[] attrs = t.GetCustomAttributes( typeof( SleepingNameAttribute ), true );
if ( attrs != null && attrs.Length > 0 )
{
SleepingNameAttribute attr = attrs[0] as SleepingNameAttribute;
if ( attr != null )
return attr.Name;
}
return m.Name;
}
示例12: GetCorpseName
public static string GetCorpseName( Mobile m )
{
Type t = m.GetType();
object[] attrs = t.GetCustomAttributes( typeof( CorpseNameAttribute ), true );
if ( attrs != null && attrs.Length > 0 )
{
CorpseNameAttribute attr = attrs[0] as CorpseNameAttribute;
if ( attr != null )
return attr.Name;
}
return null;
}
示例13: GetSaveFlag
public static int GetSaveFlag(Mobile m)
{
return ConversionTable.IndexOf(m.GetType()) + Offset;
}
示例14: Damage
public override void Damage(int amount, Mobile from)
{
if (Spells.Necromancy.EvilOmenSpell.TryEndEffect(this))
amount = (int)(amount * 1.25);
Mobile oath = Spells.Necromancy.BloodOathSpell.GetBloodOath(from);
/* Per EA's UO Herald Pub48 (ML):
* ((resist spellsx10)/20 + 10=percentage of damage resisted)
*/
if (oath == this)
{
amount = (int)(amount * 1.1);
if (amount > 35 && from is PlayerMobile) /* capped @ 35, seems no expansion */
{
amount = 35;
}
if (Core.ML)
{
from.Damage((int)(amount * (1 - (((from.Skills.MagicResist.Value * .5) + 10) / 100))), this);
}
else
{
from.Damage(amount, this);
}
}
if (from != null && Talisman is BaseTalisman)
{
BaseTalisman talisman = (BaseTalisman)Talisman;
if (talisman.Protection != null && talisman.Protection.Type != null)
{
Type type = talisman.Protection.Type;
if (type == from.GetType())
amount *= 1 - (int)(((double)talisman.Protection.Amount) / 100);
}
}
base.Damage(amount, from);
}
示例15: IsObjective
public virtual bool IsObjective( Mobile mob )
{
if ( m_Creatures == null )
return false;
if ( m_Region != null && !m_Region.Contains( mob.Location ) )
return false;
for ( int i = 0; i < m_Creatures.Length; i++ )
{
Type creature = m_Creatures[i];
if ( creature.IsAssignableFrom( mob.GetType() ) )
return true;
}
return false;
}