本文整理汇总了C#中Base.Clone方法的典型用法代码示例。如果您正苦于以下问题:C# Base.Clone方法的具体用法?C# Base.Clone怎么用?C# Base.Clone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Base
的用法示例。
在下文中一共展示了Base.Clone方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: VisitBase
public override Expression VisitBase(Base Base)
{
if (Base == null) return null;
return base.VisitBase((Base)Base.Clone());
}
示例2: UpdateStatsAndAdd
private static Base.StatsWarrior UpdateStatsAndAdd(Base.StatsWarrior statsToAdd, Base.StatsWarrior baseStats, Character character)
{
#if DEBUG
//ConstructionCounts["UpdateStatsAndAdd"]++;
#endif
Base.StatsWarrior retVal;
float newStaMult = 1f + statsToAdd.BonusStaminaMultiplier;
float newStrMult = 1f + statsToAdd.BonusStrengthMultiplier;
float newAgiMult = 1f + statsToAdd.BonusAgilityMultiplier;
float newArmMult = 1f + statsToAdd.BonusArmorMultiplier;
float newBaseArmMult = 1f + statsToAdd.BaseArmorMultiplier;
float newAtkMult = 1f + statsToAdd.BonusAttackPowerMultiplier;
float newHealthMult = 1f + statsToAdd.BonusHealthMultiplier;
if (baseStats != null) {
retVal = baseStats.Clone();
newStaMult *= (1f + retVal.BonusStaminaMultiplier);
newStrMult *= (1f + retVal.BonusStrengthMultiplier);
newAgiMult *= (1f + retVal.BonusAgilityMultiplier);
newArmMult *= (1f + retVal.BonusArmorMultiplier);
newBaseArmMult *= (1f + retVal.BaseArmorMultiplier);
newAtkMult *= (1f + retVal.BonusAttackPowerMultiplier);
newHealthMult *= (1f + retVal.BonusHealthMultiplier);
// normalize retVal with its old base stat values, since we're updating them below
// This essentially reverses what gets done to statsToAdd, but only things that
// are affected by multipliers (like base stats, armor, AP, etc)
retVal.Health -= retVal.Stamina * 10f; // Stamina is affected by a multiplier
// Since AP is set to (RawAP + 2*STR + A2T + BonusAP)*APMult, and Str/A2T are affected by mults too,
// we need to rewind the Str and Armor components out. We will add them after we've updated Str/Armor, below
retVal.AttackPower /= 1f + retVal.BonusAttackPowerMultiplier;
retVal.AttackPower -= (retVal.Strength * 2f);
// This is reversing the Armor = (Armor*BaseMult + Bonus)*BonusMult
retVal.Armor /= 1f + retVal.BonusArmorMultiplier;
retVal.Armor -= retVal.BonusArmor;
retVal.Armor /= 1f + retVal.BaseArmorMultiplier;
//retVal.BonusArmor -= retVal.Agility * 2f;
// Agi is multed, remove it from PhysicalCrit for now
retVal.PhysicalCrit -= StatConversion.GetCritFromAgility(retVal.Agility, character.Class);
} else { retVal = null; }
//statsToAdd.DeathbringerProc = 0f;
#region Base Stats
statsToAdd.Stamina *= newStaMult;
statsToAdd.Strength *= newStrMult;
statsToAdd.Agility *= newAgiMult;
if (retVal != null)
{
// change retvals to use the new mults. Combines Stat/=oldMult; Stat*=newMult
retVal.Stamina *= newStaMult / (1f + retVal.BonusStaminaMultiplier);
retVal.Strength *= newStrMult / (1f + retVal.BonusStrengthMultiplier);
retVal.Agility *= newAgiMult / (1f + retVal.BonusAgilityMultiplier);
}
#endregion
#region Health
statsToAdd.Health *= newHealthMult;
statsToAdd.Health += (statsToAdd.Stamina * 10f);
if (retVal != null)
{
// Combines rollback of oldmult and addition of newmult
retVal.Health *= newHealthMult / (1f + retVal.BonusHealthMultiplier);
retVal.Health += retVal.Stamina * 10f;
}
#endregion
#region Armor
//statsToAdd.BonusArmor += statsToAdd.Agility * 2f;
statsToAdd.Armor = (statsToAdd.Armor * newBaseArmMult + statsToAdd.BonusArmor) * newArmMult;
if (retVal != null)
{
//retVal.BonusArmor += retVal.Agility * 2f;
retVal.Armor = (retVal.Armor * newBaseArmMult + retVal.BonusArmor) * newArmMult;
}
#endregion
#region Attack Power
// stats to add
statsToAdd.AttackPower += (statsToAdd.Strength * 2f);
statsToAdd.AttackPower *= newAtkMult;
// reset retval
if (retVal != null) {
// already rolled back AP's oldmult, so not combining
retVal.AttackPower += (retVal.Strength * 2f);
retVal.AttackPower *= newAtkMult;
}
#endregion
// Crit
statsToAdd.PhysicalCrit += StatConversion.GetCritFromAgility(statsToAdd.Agility, character.Class);
statsToAdd.PhysicalCrit += StatConversion.GetCritFromRating(statsToAdd.CritRating, character.Class);
if (retVal != null) {
retVal.PhysicalCrit += StatConversion.GetCritFromAgility(retVal.Agility, character.Class);
}
//.........这里部分代码省略.........