本文整理匯總了C#中Ability.NameIs方法的典型用法代碼示例。如果您正苦於以下問題:C# Ability.NameIs方法的具體用法?C# Ability.NameIs怎麽用?C# Ability.NameIs使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Ability
的用法示例。
在下文中一共展示了Ability.NameIs方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Use
public void Use(Ability ability)
{
Ability.TargetType tt = ability.targetType;
if (tt == Ability.TargetType.Direction || tt == Ability.TargetType.Point || tt == Ability.TargetType.Creature)
B.ability = ability;
else if (tt == Ability.TargetType.None)
{
PayAbilityCost(ability);
if (ability is ClassAbility)
{
ClassAbility ca = ability as ClassAbility;
Action<string> log = s => B.log.Add(" " + s, ca.color);
if (ca.NameIs("Meld"))
{
t.effects.Add("Melded", 20);
AnimateByDefault(ability.castTime);
log("melds with surroundings.");
}
else if (ca.NameIs("Hide in Shadows"))
{
t.effects.Add("Hidden", 20);
AnimateByDefault(ability.castTime);
log("hides in shadows.");
}
}
else if (ability is ItemAbility)
{
ItemAbility ia = ability as ItemAbility;
if (ability.NameIs("Drink"))
{
if (ia.itemShape == ItemShape.Get("Nourishing Mix")) t.hp.AddStamina(100, true);
else if (ia.itemShape == ItemShape.Get("Bottled Blood"))
{
int amount = t.HasAbility("Omnivore") ? 2 : -2;
t.hp.Add(amount, true);
t.hp.AddStamina(amount, true);
}
t.inventory.Remove(ia.itemShape);
t.inventory.Add("Empty Bottle");
AnimateByDefault(ability.castTime);
}
else if (ability.NameIs("Apply to Weapon"))
{
t.effects.Add("Poisoned Weapon", 20, ia.itemShape.name);
t.inventory.Remove(ia.itemShape);
t.inventory.Add("Empty Bottle");
AnimateByDefault(ability.castTime);
}
else if (ability.NameIs("Dip"))
{
t.inventory.Remove(ia.itemShape);
var query = from o in B.GetAll(t.p.value) select o.CommonName;
if (query.Contains("Blood")) t.inventory.Add(ItemShape.Get("Bottled Blood"));
}
}
t.initiative.PassTurn(ability.castTime);
}
}