本文整理汇总了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);
}
}