本文整理汇总了C#中Combatant.HasSkill方法的典型用法代码示例。如果您正苦于以下问题:C# Combatant.HasSkill方法的具体用法?C# Combatant.HasSkill怎么用?C# Combatant.HasSkill使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Combatant
的用法示例。
在下文中一共展示了Combatant.HasSkill方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckRequirement
/*
============================================================================
Check functions
============================================================================
*/
public bool CheckRequirement(Combatant c)
{
bool check = false;
if(StatusNeeded.STATUS_VALUE.Equals(this.statusNeeded) &&
c.status[this.statID].CompareTo(this.value, this.comparison, this.setter, c))
{
check = true;
}
else if(StatusNeeded.ELEMENT.Equals(this.statusNeeded))
{
int element = c.GetElementDefence(this.statID);
if((ValueCheck.EQUALS.Equals(this.comparison) && element == this.value) ||
(ValueCheck.LESS.Equals(this.comparison) && element < this.value) ||
(ValueCheck.GREATER.Equals(this.comparison) && element > this.value))
{
check = true;
}
}
else if(StatusNeeded.SKILL.Equals(this.statusNeeded) && c.HasSkill(this.statID, 0))
{
check = true;
}
else if(StatusNeeded.RACE.Equals(this.statusNeeded) && c.raceID == this.statID)
{
check = true;
}
else if(StatusNeeded.SIZE.Equals(this.statusNeeded) && c.sizeID == this.statID)
{
check = true;
}
else if(StatusNeeded.LEVEL.Equals(this.statusNeeded))
{
int lvl = c.currentLevel;
if(this.classLevel) lvl = c.currentClassLevel;
if((ValueCheck.EQUALS.Equals(this.comparison) && lvl == this.value) ||
(ValueCheck.LESS.Equals(this.comparison) && lvl < this.value) ||
(ValueCheck.GREATER.Equals(this.comparison) && lvl > this.value))
{
check = true;
}
}
return check;
}
示例2: GetAction
/*
============================================================================
Action handling functions
============================================================================
*/
public BattleAction GetAction(Combatant c, int valid, Combatant[] allies, Combatant[] enemies)
{
BattleAction action = new BattleAction();
bool found = false;
bool targetEnemy = false;
int difID = GameHandler.GetDifficulty();
if(this.difficultyID <= difID)
{
for(int i=0; i<this.attackSelection.Length; i++)
{
if(this.actionDifficultyID[i] <= difID)
{
if(valid == -2 && c.attackPartyTarget && DataHolder.BattleControl().HasPartyTarget())
{
action.targetID = DataHolder.BattleControl().GetPartyTargetID();
}
else if(valid == -2 && c.attackLastTarget && c.lastTargetBattleID >= 0 &&
DataHolder.BattleSystem().CheckForID(c.lastTargetBattleID, enemies, true))
{
action.targetID = c.lastTargetBattleID;
}
else
{
action.targetID = valid;
}
action.type = this.attackSelection[i];
// set up base attack
if(action.IsAttack() && !c.IsBlockAttack())
{
targetEnemy = true;
if(valid == -2)
{
if(c.aiNearestTarget)
{
action.targetID = c.GetNearestTarget(enemies);
}
else
{
action.targetID = c.GetRandomTarget(enemies);
}
}
found = true;
}
// set up skill
else if(action.IsSkill() && !c.IsBlockSkills() &&
c.HasSkill(this.useID[i], this.useLevel[i]) &&
DataHolder.Skill(this.useID[i]).CanUse(c, this.useLevel[i]-1))
{
action.useID = this.useID[i];
action.useLevel = this.useLevel[i]-1;
if(DataHolder.Skill(action.useID).TargetSelf())
{
action.targetID = c.battleID;
}
else if(DataHolder.Skill(action.useID).TargetNone())
{
action.targetID = BattleAction.NONE;
if(DataHolder.Skill(action.useID).targetRaycast.active)
{
GameObject target = null;
if(c.aiNearestTarget)
{
if(DataHolder.Skill(action.useID).TargetEnemy())
{
target = c.GetNearestTargetObject(enemies);
}
else if(DataHolder.Skill(action.useID).TargetAlly())
{
target = c.GetNearestTargetObject(allies);
}
}
else
{
if(DataHolder.Skill(action.useID).TargetEnemy())
{
target = c.GetRandomTargetObject(enemies);
}
else if(DataHolder.Skill(action.useID).TargetAlly())
{
target = c.GetRandomTargetObject(allies);
}
}
if(target != null)
{
action.rayTargetSet = true;
action.rayPoint = DataHolder.Skill(action.useID).targetRaycast.GetAIPoint(
c.prefabInstance, target);
}
}
}
else if(DataHolder.Skill(action.useID).TargetAllyGroup() && c is Enemy)
{
action.targetID = BattleAction.ALL_ENEMIES;
}
else if(DataHolder.Skill(action.useID).TargetAllyGroup() && c is Character)
//.........这里部分代码省略.........