本文整理汇总了C#中Aura.Channel.World.Entities.Creature.GetPowerRating方法的典型用法代码示例。如果您正苦于以下问题:C# Creature.GetPowerRating方法的具体用法?C# Creature.GetPowerRating怎么用?C# Creature.GetPowerRating使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Aura.Channel.World.Entities.Creature
的用法示例。
在下文中一共展示了Creature.GetPowerRating方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateWeapon
/// <summary>
/// Reduces weapon's durability and increases its proficiency.
/// Only updates weapon type items that are not null.
/// </summary>
/// <param name="attacker">Creature who's weapon is updated.</param>
/// <param name="target">
/// The target of the skill, used for power rating calculations.
/// If target is null, prof will be rewarded regardless of target.
/// </param>
/// <param name="weapons">Weapons to update.</param>
public static void UpdateWeapon(Creature attacker, Creature target, ProficiencyGainType profGainType, params Item[] weapons)
{
if (attacker == null)
return;
var rnd = RandomProvider.Get();
// Add prof if no target was specified or the target is not "Weakest".
var addProf = (target == null || attacker.GetPowerRating(target) >= PowerRating.Weak);
foreach (var weapon in weapons.Where(a => a != null && a.IsTrainableWeapon))
{
// Durability
var reduce = rnd.Next(1, 30);
attacker.Inventory.ReduceDurability(weapon, reduce);
// Don't add prof if weapon is broken.
if (weapon.Durability == 0)
addProf = false;
// Proficiency
if (addProf)
{
var amount = Item.GetProficiencyGain(attacker.Age, profGainType);
attacker.Inventory.AddProficiency(weapon, amount);
}
}
}
示例2: UpdateWeapon
/// <summary>
/// Reduces weapon's durability and increases its proficiency.
/// Only updates weapon type items that are not null.
/// </summary>
/// <param name="creature"></param>
/// <param name="weapon"></param>
public static void UpdateWeapon(Creature attacker, Creature target, params Item[] weapons)
{
if (attacker == null)
return;
var rnd = RandomProvider.Get();
foreach (var weapon in weapons.Where(a => a != null && a.IsTrainableWeapon))
{
// Durability
if (!ChannelServer.Instance.Conf.World.NoDurabilityLoss)
{
var reduce = rnd.Next(1, 30);
// Half dura loss if blessed
if (weapon.IsBlessed)
reduce = Math.Max(1, reduce / 2);
weapon.Durability -= reduce;
Send.ItemDurabilityUpdate(attacker, weapon);
}
// Proficiency
// Only if the weapon isn't broken and the target is not "Weakest".
if (weapon.Durability != 0 && attacker != null && attacker.GetPowerRating(target) >= PowerRating.Weak)
{
short prof = 0;
if (attacker.Age >= 10 && attacker.Age <= 12)
prof = 48;
else if (attacker.Age >= 13 && attacker.Age <= 19)
prof = 60;
else
prof = 72;
weapon.Proficiency += prof;
Send.ItemExpUpdate(attacker, weapon);
}
}
}
示例3: Train
/// <summary>
/// Handles Sharp Mind training.
/// </summary>
/// <param name="skillUser"></param>
/// <param name="target"></param>
public static void Train(Creature skillUser, Creature target, bool success)
{
if (!success)
return;
var targetSkill = target.Skills.Get(SkillId.SharpMind);
if (targetSkill == null) return;
var rating = target.GetPowerRating(skillUser);
var skillRank = targetSkill.Info.Rank;
if (skillRank >= SkillRank.Novice && skillRank <= SkillRank.RB)
targetSkill.Train(1); // Successfully notice an enemy's skill.
if (skillRank >= SkillRank.RF && skillRank <= SkillRank.RB && rating == PowerRating.Normal)
targetSkill.Train(2); // Successfully notice a same level enemy's skill.
if (skillRank >= SkillRank.RD && skillRank <= SkillRank.RB && rating == PowerRating.Strong)
targetSkill.Train(3); // Successfully notice a strong enemy's skill.
if (skillRank == SkillRank.RB && rating == PowerRating.Awful)
targetSkill.Train(4); // Successfully notice an awful enemy's skill.
}