本文整理汇总了C#中GameLiving.GetModified方法的典型用法代码示例。如果您正苦于以下问题:C# GameLiving.GetModified方法的具体用法?C# GameLiving.GetModified怎么用?C# GameLiving.GetModified使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GameLiving
的用法示例。
在下文中一共展示了GameLiving.GetModified方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CalcValue
public override int CalcValue(GameLiving living, eProperty property)
{
int abs = Math.Min(living.BaseBuffBonusCategory[(int)property]
- living.DebuffCategory[(int)property]
+ living.ItemBonus[(int)property]
+ living.AbilityBonus[(int)property], 50);
if (living is GameNPC)
{
if (living.Level >= 30) abs += 27;
else if (living.Level >= 20) abs += 19;
else if (living.Level >= 10) abs += 10;
abs += (living.GetModified(eProperty.Constitution)
+ living.GetModified(eProperty.Dexterity) - 120) / 12;
}
return abs;
}
示例2: CalcValue
public override int CalcValue(GameLiving living, eProperty property)
{
int abs = Math.Min(living.BaseBuffBonusCategory[(int)property]
- living.DebuffCategory[(int)property]
+ living.ItemBonus[(int)property]
+ living.AbilityBonus[(int)property], 50);
bool bTest = false;
if (living is GamePlayer)
{
GamePlayer player = (GamePlayer)living;
if (player.TempProperties.getProperty<string>(GamePlayer.AFK_MESSAGE) == "test") bTest = true;
}
if (bTest)
{
GamePlayer player = (GamePlayer)living;
player.Out.SendMessage("/// ArmorAbsorptionCalculator ///", eChatType.CT_System, eChatLoc.CL_SystemWindow);
player.Out.SendMessage("living.BaseBuffBonusCategory[(int)property] : " + living.BaseBuffBonusCategory[(int)property], eChatType.CT_System, eChatLoc.CL_SystemWindow);
player.Out.SendMessage("living.DebuffCategory[(int)property] : " + living.DebuffCategory[(int)property], eChatType.CT_System, eChatLoc.CL_SystemWindow);
player.Out.SendMessage("living.ItemBonus[(int)property] : " + living.ItemBonus[(int)property], eChatType.CT_System, eChatLoc.CL_SystemWindow);
player.Out.SendMessage("living.AbilityBonus[(int)property] : " + living.AbilityBonus[(int)property], eChatType.CT_System, eChatLoc.CL_SystemWindow);
player.Out.SendMessage("int abs = Math.Min(living.BaseBuffBonusCategory[(int)property] - living.DebuffCategory[(int)property] + living.ItemBonus[(int)property] + living.AbilityBonus[(int)property], 50); : " + abs, eChatType.CT_System, eChatLoc.CL_SystemWindow);
}
if (living is GameNPC)
{
if (living.Level >= 30) abs += 27;
else if (living.Level >= 20) abs += 19;
else if (living.Level >= 10) abs += 10;
abs += (living.GetModified(eProperty.Constitution)
+ living.GetModified(eProperty.Dexterity) - 120) / 12;
}
return abs;
}
示例3: CalculateEnduranceCost
/// <summary>
/// Calculates endurance needed to use style
/// </summary>
/// <param name="living">The living doing the style</param>
/// <param name="style">The style to be used</param>
/// <param name="weaponSpd">The weapon speed</param>
/// <returns>Endurance needed to use style</returns>
public static int CalculateEnduranceCost(GameLiving living, Style style, int weaponSpd)
{
//[StephenxPimentel]
//1.108 - Valhallas Blessing now has a 75% chance to not use endurance.
// Apply Valkyrie RA5L effect
ValhallasBlessingEffect ValhallasBlessing = living.EffectList.GetOfType<ValhallasBlessingEffect>();
if (ValhallasBlessing != null && Util.Chance(75)) return 0;
//Camelot Herald 1.90 : Battlemaster styles will now cost a flat amount of Endurance, regardless of weapon speed
if (style.Spec == Specs.Battlemaster)
return Math.Max(1, (int)Math.Ceiling((30 * style.EnduranceCost / 40) * living.GetModified(eProperty.FatigueConsumption) * 0.01));
int fatCost = weaponSpd * style.EnduranceCost / 40;
if (weaponSpd < 40)
fatCost++;
fatCost = (int)Math.Ceiling(fatCost * living.GetModified(eProperty.FatigueConsumption) * 0.01);
return Math.Max(1, fatCost);
}
示例4: Execute
/// <summary>
/// Action
/// </summary>
/// <param name="living"></param>
public override void Execute(GameLiving living)
{
if (CheckPreconditions(living, DEAD | SITTING | MEZZED | STUNNED)) return;
bool deactivate = false;
AbstractServerRules rules = GameServer.ServerRules as AbstractServerRules;
GamePlayer player = living as GamePlayer;
GamePlayer target = living.TargetObject as GamePlayer;
if (player.TargetObject == null || target == null)
{
player.Out.SendMessage("You must target a player to launch this spell!", eChatType.CT_SpellResisted, eChatLoc.CL_SystemWindow);
return;
}
if (!GameServer.ServerRules.IsAllowedToAttack(living, target, true))
{
player.Out.SendMessage("You must select an enemy target!", eChatType.CT_SpellResisted, eChatLoc.CL_SystemWindow);
return;
}
if (!living.IsWithinRadius(target, (int)(1500 * living.GetModified(eProperty.SpellRange) * 0.01)))
{
Message.ChatToOthers(living, "You are too far away from your target to use this ability!", eChatType.CT_SpellResisted);
return;
}
SendCasterSpellEffectAndCastMessage(living, 3505, true);
DamageTarget(target, living, 0);
deactivate = true;
GamePlayer m_oldtarget = target;
GamePlayer m_newtarget = null;
for (int x = 1; x < 5; x++)
{
if (m_newtarget != null)
m_oldtarget = m_newtarget;
foreach (GamePlayer p in m_oldtarget.GetPlayersInRadius(500))
{
if (p != m_oldtarget && p != living && GameServer.ServerRules.IsAllowedToAttack(living, p, true))
{
DamageTarget(p, living, x);
p.StartInterruptTimer(3000, AttackData.eAttackType.Spell, living);
m_newtarget = p;
break;
}
}
}
if (deactivate)
DisableSkill(living);
}
示例5: ExecuteStyle
/// <summary>
/// Executes the style of the given player. Prints
/// out messages to the player notifying him of his success or failure.
/// </summary>
/// <param name="living">The living executing the styles</param>
/// <param name="attackData">
/// The AttackData that will be modified to contain the
/// new damage and the executed style.
/// </param>
/// <param name="weapon">The weapon used to execute the style</param>
/// <returns>true if a style was performed, false if not</returns>
public static bool ExecuteStyle(GameLiving living, AttackData attackData, InventoryItem weapon)
{
//First thing in processors, lock the objects you modify
//This way it makes sure the objects are not modified by
//several different threads at the same time!
GamePlayer player = living as GamePlayer;
lock (living)
{
//Does the player want to execute a style at all?
if (attackData.Style == null)
return false;
if (weapon != null && weapon.Object_Type == (int)eObjectType.Shield)
{
attackData.AnimationId = (weapon.Hand != 1) ? attackData.Style.Icon : attackData.Style.TwoHandAnimation; // 2h shield?
}
int fatCost = 0;
if (weapon != null)
fatCost = CalculateEnduranceCost(living, attackData.Style, weapon.SPD_ABS);
//Reduce endurance if styled attack missed
switch (attackData.AttackResult)
{
case GameLiving.eAttackResult.Blocked:
case GameLiving.eAttackResult.Evaded:
case GameLiving.eAttackResult.Missed:
case GameLiving.eAttackResult.Parried:
if (player != null) //No mob endu lost yet
living.Endurance -= Math.Max(1, fatCost / 2);
return false;
}
//Ignore all other attack results
if (attackData.AttackResult != GameLiving.eAttackResult.HitUnstyled
&& attackData.AttackResult != GameLiving.eAttackResult.HitStyle)
return false;
//Did primary and backup style fail?
if (!CanUseStyle(living, attackData.Style, weapon))
{
if (player != null)
{
// reduce players endurance, full endurance if failed style
player.Endurance -= fatCost;
//"You must be hidden to perform this style!"
//Print a style-fail message
player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client, "StyleProcessor.ExecuteStyle.ExecuteFail", attackData.Style.Name), eChatType.CT_YouHit, eChatLoc.CL_SystemWindow);
}
return false;
}
else
{
double effectivness = 1.0;
if (attackData.Target is GameNPC && player != null)
{
IControlledBrain brain = ((GameNPC)attackData.Target).Brain as IControlledBrain;
if (brain == null)
effectivness *= 2;
}
//Style worked! Print out some nice info and add the damage! :)
//Growth Rate * Style Spec * Effective Speed / Unstyled Damage Cap
int styledDamageCap = 0;
double factor = 1.0;
//critical strike for rogue
// from: http://www.classesofcamelot.com/other/styles/Styles.htm
//Assassination styles (BS, BS2, PA) work differently than normal styles.
//Since these styles can only be used as an opener from stealth, these styles have had the DPS portion coded out
//and just add a static damage value. This allows for assassins to use fast weapons and still hit hard with their assassination styles.
//Furthermore, since the assassination styles add a static damage amount, faster weapons actually allow for a higher DPS than slower
//weapons in this case. Thus, one can debate the benefits of a slow assassination weapon versus a fast one.
//
//Backstab I Cap = ~5 + Critical Strike Spec * 14 / 3 + Nonstyle Cap
//Backstab II Cap = 45 + Critical Strike Spec * 6 + Nonstyle Cap
//Perforate Artery Cap = 75 + Critical Strike Spec * 9 + Nonstyle Cap
//
if (attackData.Target is GameNPC || attackData.Target is GamePlayer)
{
if (attackData.Style.Name == (LanguageMgr.GetTranslation(ServerProperties.Properties.DB_LANGUAGE, "StyleProcessor.ExecuteStyle.StyleNameBackstab")))
{
factor = (5 + living.GetModifiedSpecLevel(Specs.Critical_Strike) * 14 / 3.0) / living.UnstyledDamageCap(weapon);
attackData.StyleDamage = (int)Math.Max(1, attackData.UncappedDamage * factor * ServerProperties.Properties.CS_OPENING_EFFECTIVENESS);
styledDamageCap = (int)((5 + (living.GetModifiedSpecLevel(Specs.Critical_Strike) * 14 / 3.0 + living.UnstyledDamageCap(weapon))) * effectivness);
}
else if (attackData.Style.Name == (LanguageMgr.GetTranslation(ServerProperties.Properties.DB_LANGUAGE, "StyleProcessor.ExecuteStyle.StyleNameBackstabII")))
//.........这里部分代码省略.........
示例6: Start
/// <summary>
/// Start the stag on player
/// </summary>
/// <param name="living">The living object the effect is being started on</param>
public override void Start(GameLiving living)
{
base.Start(living);
m_originalModel = living.Model;
if (living is GamePlayer)
{
if ((living as GamePlayer).Race == (int)eRace.Lurikeen)
living.Model = 859;
else living.Model = 583;
}
double m_amountPercent = (m_level + 0.5 + Util.RandomDouble()) / 10; //+-5% random
if (living is GamePlayer)
m_amount = (int)((living as GamePlayer).CalculateMaxHealth(living.Level, living.GetModified(eProperty.Constitution)) * m_amountPercent);
else m_amount = (int)(living.MaxHealth * m_amountPercent);
living.BaseBuffBonusCategory[(int)eProperty.MaxHealth] += m_amount;
living.Health += (int)(living.GetModified(eProperty.MaxHealth) * m_amountPercent);
if (living.Health > living.MaxHealth) living.Health = living.MaxHealth;
living.Emote(eEmote.StagFrenzy);
if (living is GamePlayer)
{
(living as GamePlayer).Out.SendUpdatePlayer();
(living as GamePlayer).Out.SendMessage(LanguageMgr.GetTranslation((living as GamePlayer).Client, "Effects.StagEffect.HuntsSpiritChannel"), eChatType.CT_YouHit, eChatLoc.CL_SystemWindow);
}
}
示例7: CalculateEffectDuration
/// <summary>
/// Calculates the effect duration in milliseconds
/// </summary>
/// <param name="target">The effect target</param>
/// <param name="effectiveness">The effect effectiveness</param>
/// <returns>The effect duration in milliseconds</returns>
protected override int CalculateEffectDuration(GameLiving target, double effectiveness)
{
double duration = base.CalculateEffectDuration(target, effectiveness);
duration *= target.GetModified(eProperty.StunDurationReduction) * 0.01;
if (duration < 1)
duration = 1;
else if (duration > (Spell.Duration * 4))
duration = (Spell.Duration * 4);
return (int)duration;
}
示例8: DamageTarget
private void DamageTarget(GameLiving target)
{
if (!GameServer.ServerRules.IsAllowedToAttack(owner, target, true))
return;
if (!target.IsAlive)
return;
if (ticktimer.IsAlive)
{
ticktimer.Stop();
removeHandlers();
}
int dist = target.GetDistanceTo( new Point3D( traparea.X, traparea.Y, traparea.Z ) );
double mod = 1;
if (dist > 0)
mod = 1 - ((double)dist / 350);
int basedamage = (int)(effectiveness * mod);
int resist = (int)(basedamage * target.GetModified(eProperty.Resist_Energy) * -0.01);
int damage = basedamage + resist;
GamePlayer player = owner as GamePlayer;
if (player != null)
{
player.Out.SendMessage("You hit " + target.Name + " for " + damage + "(" + resist + ") points of damage!", eChatType.CT_YouHit, eChatLoc.CL_SystemWindow);
}
GamePlayer targetPlayer = target as GamePlayer;
if (targetPlayer != null)
{
if (targetPlayer.IsStealthed)
targetPlayer.Stealth(false);
}
foreach (GamePlayer p in target.GetPlayersInRadius(false, WorldMgr.VISIBILITY_DISTANCE))
{
p.Out.SendSpellEffectAnimation(owner, target, 7026, 0, false, 1);
p.Out.SendCombatAnimation(owner, target, 0, 0, 0, 0, 0x14, target.HealthPercent);
}
//target.TakeDamage(owner, eDamageType.Energy, damage, 0);
AttackData ad = new AttackData();
ad.AttackResult = GameLiving.eAttackResult.HitUnstyled;
ad.Attacker = owner;
ad.Target = target;
ad.DamageType = eDamageType.Energy;
ad.Damage = damage;
target.OnAttackedByEnemy(ad);
owner.DealDamage(ad);
}
示例9: CalcValue
public override int CalcValue(GameLiving living, eProperty property)
{
if (living is GamePlayer)
{
GamePlayer player = living as GamePlayer;
int hpBase = player.CalculateMaxHealth(player.Level, player.GetModified(eProperty.Constitution));
int buffBonus = living.BaseBuffBonusCategory[(int)property];
if (buffBonus < 0) buffBonus = (int)((1 + (buffBonus / -100.0)) * hpBase)-hpBase;
int itemBonus = living.ItemBonus[(int)property];
int cap = Math.Max(player.Level * 4, 20) + // at least 20
Math.Min(living.ItemBonus[(int)eProperty.MaxHealthCapBonus], player.Level * 4);
itemBonus = Math.Min(itemBonus, cap);
if (player.HasAbility(Abilities.ScarsOfBattle) && player.Level >= 40)
{
int levelbonus = Math.Min(player.Level - 40, 10);
hpBase = (int)(hpBase * (100 + levelbonus) * 0.01);
}
int abilityBonus = living.AbilityBonus[(int)property];
return Math.Max(hpBase + itemBonus + buffBonus + abilityBonus, 1); // at least 1
}
else if ( living is GameKeepComponent )
{
GameKeepComponent keepComp = living as GameKeepComponent;
if (keepComp.Keep != null)
return (keepComp.Keep.EffectiveLevel(keepComp.Keep.Level) + 1) * keepComp.Keep.BaseLevel * 200;
return 0;
}
else if ( living is GameKeepDoor )
{
GameKeepDoor keepdoor = living as GameKeepDoor;
if (keepdoor.Component != null && keepdoor.Component.Keep != null)
{
return (keepdoor.Component.Keep.EffectiveLevel(keepdoor.Component.Keep.Level) + 1) * keepdoor.Component.Keep.BaseLevel * 200;
}
return 0;
//todo : use material too to calculate maxhealth
}
else if (living is GameNPC)
{
int hp = 0;
if (living.Level<10)
{
hp = living.Level * 20 + 20 + living.BaseBuffBonusCategory[(int)property]; // default
}
else
{
// approx to original formula, thx to mathematica :)
hp = (int)(50 + 11*living.Level + 0.548331 * living.Level * living.Level) + living.BaseBuffBonusCategory[(int)property];
if (living.Level < 25)
hp += 20;
}
int basecon = (living as GameNPC).Constitution;
int conmod = 20; // at level 50 +75 con ~= +300 hit points
// first adjust hitpoints based on base CON
if (basecon != ServerProperties.Properties.GAMENPC_BASE_CON)
{
hp = Math.Max(1, hp + ((basecon - ServerProperties.Properties.GAMENPC_BASE_CON) * ServerProperties.Properties.GAMENPC_HP_GAIN_PER_CON));
}
// Now adjust for buffs
// adjust hit points based on constitution difference from base con
// modified from http://www.btinternet.com/~challand/hp_calculator.htm
int conhp = hp + (conmod * living.Level * (living.GetModified(eProperty.Constitution) - basecon) / 250);
// 50% buff / debuff cap
if (conhp > hp * 1.5)
conhp = (int)(hp * 1.5);
else if (conhp < hp / 2)
conhp = hp / 2;
return conhp;
}
else
{
if (living.Level < 10)
{
return living.Level * 20 + 20 + living.BaseBuffBonusCategory[(int)property]; // default
}
else
{
// approx to original formula, thx to mathematica :)
int hp = (int)(50 + 11 * living.Level + 0.548331 * living.Level * living.Level) + living.BaseBuffBonusCategory[(int)property];
if (living.Level < 25)
{
hp += 20;
}
return hp;
}
}
//.........这里部分代码省略.........
示例10: ExecuteStyle
/// <summary>
/// Executes the style of the given player. Prints
/// out messages to the player notifying him of his success or failure.
/// </summary>
/// <param name="living">The living executing the styles</param>
/// <param name="attackData">
/// The AttackData that will be modified to contain the
/// new damage and the executed style.
/// </param>
/// <param name="weapon">The weapon used to execute the style</param>
/// <returns>true if a style was performed, false if not</returns>
public static bool ExecuteStyle(GameLiving living, AttackData attackData, InventoryItem weapon)
{
//First thing in processors, lock the objects you modify
//This way it makes sure the objects are not modified by
//several different threads at the same time!
GamePlayer player = living as GamePlayer;
lock (living)
{
//Does the player want to execute a style at all?
if (attackData.Style == null)
return false;
if (weapon != null && weapon.Object_Type == (int)eObjectType.Shield)
{
attackData.AnimationId = (weapon.Hand != 1) ? attackData.Style.Icon : attackData.Style.TwoHandAnimation; // 2h shield?
}
int fatCost = 0;
if (weapon != null)
fatCost = CalculateEnduranceCost(living, attackData.Style, weapon.SPD_ABS);
//Reduce endurance if styled attack missed
switch (attackData.AttackResult)
{
case GameLiving.eAttackResult.Blocked:
case GameLiving.eAttackResult.Evaded:
case GameLiving.eAttackResult.Missed:
case GameLiving.eAttackResult.Parried:
if (player != null) //No mob endu lost yet
living.Endurance -= Math.Max(1, fatCost / 2);
return false;
}
//Ignore all other attack results
if (attackData.AttackResult != GameLiving.eAttackResult.HitUnstyled
&& attackData.AttackResult != GameLiving.eAttackResult.HitStyle)
return false;
//Did primary and backup style fail?
if (!CanUseStyle(living, attackData.Style, weapon))
{
if (player != null)
{
// reduce players endurance, full endurance if failed style
player.Endurance -= fatCost;
//"You must be hidden to perform this style!"
//Print a style-fail message
player.Out.SendMessage(LanguageMgr.GetTranslation(player.Client.Account.Language, "StyleProcessor.ExecuteStyle.ExecuteFail", attackData.Style.Name), eChatType.CT_YouHit, eChatLoc.CL_SystemWindow);
}
return false;
}
else
{
//Style worked! Print out some nice info and add the damage! :)
//Growth * Style Spec * Effective Speed / Unstyled Damage Cap
bool staticGrowth = attackData.Style.StealthRequirement; //static growth is not a function of (effective) weapon speed
double absorbRatio = attackData.Damage / living.UnstyledDamageCap(weapon); //scaling factor for style damage
double effectiveWeaponSpeed = living.AttackSpeed(weapon) * 0.001;
double styleGrowth = Math.Max(0,attackData.Style.GrowthOffset + attackData.Style.GrowthRate * living.GetModifiedSpecLevel(attackData.Style.Spec));
double styleDamageBonus = living.GetModified(eProperty.StyleDamage) * 0.01 - 1;
if (staticGrowth)
{
if (living.AttackWeapon.Item_Type == Slot.TWOHAND)
{
styleGrowth = styleGrowth * 1.25 + living.WeaponDamage(living.AttackWeapon) * Math.Max(0,living.AttackWeapon.SPD_ABS - 21) * 10 / 66d;
}
attackData.StyleDamage = (int)(absorbRatio * styleGrowth * ServerProperties.Properties.CS_OPENING_EFFECTIVENESS);
}
else
attackData.StyleDamage = (int)(absorbRatio * styleGrowth * effectiveWeaponSpeed);
attackData.StyleDamage += (int)(attackData.Damage * styleDamageBonus);
//Eden - style absorb bonus
int absorb=0;
if(attackData.Target is GamePlayer && attackData.Target.GetModified(eProperty.StyleAbsorb) > 0)
{
absorb=(int)Math.Floor((double)attackData.StyleDamage * ((double)attackData.Target.GetModified(eProperty.StyleAbsorb)/100));
attackData.StyleDamage -= absorb;
}
//Increase regular damage by styledamage ... like on live servers
attackData.Damage += attackData.StyleDamage;
if (player != null)
{
//.........这里部分代码省略.........