本文整理汇总了C#中ISpell.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# ISpell.GetType方法的具体用法?C# ISpell.GetType怎么用?C# ISpell.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ISpell
的用法示例。
在下文中一共展示了ISpell.GetType方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SpellAllowed
public bool SpellAllowed(ISpell s)
{
Type stype = s.GetType();
foreach (Type type in m_BeneficialTypes)
if (type == stype)
{
m_Spell = s.GetType();
return true;
}
if (s.GetType() == m_Spell)
m_CastCount++;
else
{
m_Spell = s.GetType();
m_CastCount = 1;
}
if (m_CastCount > 3)
{
m_Part.SendMessage("You have already tried to cast that spell three times in a row!");
return false;
}
return true;
}
示例2: ValidateAttack
protected void ValidateAttack(ISpell spellToCast)
{
if (this.Unit.EnergyPoints < spellToCast.EnergyCost)
throw new NotEnoughEnergyException(string.Format("{0} does not have enough energy to cast {1}", unit.Name, spellToCast.GetType().Name));
unit.EnergyPoints -= spellToCast.EnergyCost;
}
示例3: ValidateEnergyPoints
public void ValidateEnergyPoints(IUnit unit, ISpell spell)
{
if (unit.EnergyPoints < spell.EnergyCost)
{
throw new NotEnoughEnergyException(
string.Format("{0} does not have enough energy to cast {1}", unit.Name, spell.GetType().Name));
}
}
示例4: ValidateEnergy
public void ValidateEnergy(ISpell attack)
{
if (this.Unit.EnergyPoints - attack.EnergyCost < 0)
{
throw new NotEnoughEnergyException(String.Format(GlobalMessages.NotEnoughEnergy, this.Unit.Name,
attack.GetType().Name));
}
}
示例5: HasEnoughEnergy
public static bool HasEnoughEnergy(IUnit unit, ISpell spell)
{
if (unit.EnergyPoints - spell.EnergyCost < 0)
{
var message = string.Format(GlobalMessages.NotEnoughEnergy, unit.Name, spell.GetType().Name);
throw new NotEnoughEnergyException(message);
}
return true;
}
示例6: IsThereEnoughEnergy
protected void IsThereEnoughEnergy(ISpell attack)
{
if (this.Unit.EnergyPoints < attack.EnergyCost)
{
throw new NotEnoughEnergyException(string.Format(
GlobalMessages.NotEnoughEnergy,
this.Unit.Name,
attack.GetType().Name));
}
}
示例7: CastSpell
public void CastSpell(Player player, ISpell spell)
{
player.CastSpell(spell);
if (spell.GetType() == typeof (Shield))
{
player.IsShielded = true;
}
if (!spell.Target.IsShielded)
{
spell.Target.Health -= spell.Damage;
}
}
示例8: GetRegistryNumber
public static int GetRegistryNumber( ISpell s )
{
return GetRegistryNumber( s.GetType() );
}
示例9: GetRegistryNumber
public static int GetRegistryNumber( ISpell s ) {
Type[] t = SpellRegistry.Types;
for( int i = 0; i < t.Length; i++ ) {
if( s.GetType() == t[i] )
return i;
}
return -1;
}
示例10: CheckSpellCast
public virtual bool CheckSpellCast(Mobile caster, ISpell spell)
{
if (caster == null || caster.Deleted || spell == null)
{
return false;
}
if (!DebugMode && caster.AccessLevel >= AccessLevel.Counselor)
{
return true;
}
if (!(spell is Spell))
{
return true;
}
if (!Options.Rules.CanFly)
{
var t = spell.GetType();
if (t.Name.ContainsAny("FlySpell", "FlightSpell"))
{
return false;
}
}
return !Options.Restrictions.Spells.IsRestricted((Spell)spell);
}
示例11: OnSpellCastDeny
protected override void OnSpellCastDeny(Mobile caster, ISpell spell)
{
if (Crystal != null && !Crystal.Deleted && Crystal.Carrier == caster && spell != null)
{
Type st = spell.GetType();
if (_NoCarrySpellCasts.Contains(st))
{
string name = spell is Spell ? ((Spell)spell).Name : st.Name.Replace("Spell", String.Empty).SpaceWords();
caster.SendMessage(33, "You cannot cast {0} while holding the Crystal of Power!", name);
return;
}
}
base.OnSpellCastDeny(caster, spell);
}
示例12: CheckSpellCast
public override bool CheckSpellCast(Mobile caster, ISpell spell)
{
if (!base.CheckSpellCast(caster, spell))
{
return false;
}
if (Crystal != null && !Crystal.Deleted && Crystal.Carrier == caster && spell != null && _NoCarrySpellCasts.Contains(spell.GetType()))
{
return false;
}
return true;
}
示例13: GetSpellInfo
public static SpellInfo GetSpellInfo(ISpell s)
{
return s != null ? GetSpellInfo(s.GetType()) : null;
}
示例14: GetRegistryNumber
public static int GetRegistryNumber(ISpell s)
{
return s != null ? GetRegistryNumber(s.GetType()) : -1;
}