本文整理汇总了C#中ICreaturesInBattle类的典型用法代码示例。如果您正苦于以下问题:C# ICreaturesInBattle类的具体用法?C# ICreaturesInBattle怎么用?C# ICreaturesInBattle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ICreaturesInBattle类属于命名空间,在下文中一共展示了ICreaturesInBattle类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: ChangeDamageWhenAttacking
public override decimal ChangeDamageWhenAttacking(
ICreaturesInBattle attackerWithSpecialty,
ICreaturesInBattle defender,
decimal currentDamage)
{
if (attackerWithSpecialty == null)
{
throw new ArgumentNullException("attackerWithSpecialty");
}
if (defender == null)
{
throw new ArgumentNullException("defender");
}
if (this.Rounds <= 0)
{
// Effect expires after fixed number of rounds
return currentDamage;
}
//attackerWithSpecialty.CurrentDefense *= 2;
this.rounds--;
return currentDamage * 2;
}
开发者ID:eslavov11,项目名称:SoftUni-Homework,代码行数:26,代码来源:DoubleDamage.cs
示例2: ApplyWhenAttacking
public override void ApplyWhenAttacking(
ICreaturesInBattle attackerWithSpecialty,
ICreaturesInBattle defender)
{
if (defender == null)
{
throw new ArgumentNullException("defender");
}
if (attackerWithSpecialty == null)
{
throw new ArgumentNullException("attackerWithSpecialty");
}
if (this.rounds <= 0)
{
// Effect expires after fixed number of rounds
return;
}
attackerWithSpecialty.CurrentAttack *= 2;
this.rounds--;
// I don't remove invoking base method, because in future could be added some different logic.
base.ApplyWhenAttacking(attackerWithSpecialty, defender);
}
开发者ID:antonpopov,项目名称:TelerikAcademy,代码行数:26,代码来源:DoubleAttackWhenAttacking.cs
示例3: ApplyOnSkip
public override void ApplyOnSkip(ICreaturesInBattle skipCreature)
{
if (skipCreature == null)
{
throw new NullReferenceException("skipCreature");
}
}
开发者ID:zlatkovtv,项目名称:SoftUni_OOP,代码行数:7,代码来源:AddAttackWhenSkip.cs
示例4: AddCreaturesByIdentifier
protected override void AddCreaturesByIdentifier(CreatureIdentifier creatureIdentifier, ICreaturesInBattle creaturesInBattle)
{
if (creatureIdentifier == null)
{
throw new ArgumentNullException("creatureIdentifier");
}
if (creaturesInBattle == null)
{
throw new ArgumentNullException("creaturesInBattle");
}
if (creatureIdentifier.ArmyNumber >= 3)
{
int armyNumber = creatureIdentifier.ArmyNumber;
if (armies.Capacity < armyNumber)
{
armies.AddRange(new ICollection<ICreaturesInBattle>[armyNumber - armies.Capacity + 1]);
}
if (armies[armyNumber] == null)
{
armies[armyNumber] = new List<ICreaturesInBattle>();
}
this.armies[armyNumber].Add(creaturesInBattle);
//this.thirthArmyCreatures.Add(creaturesInBattle);
}
else
{
base.AddCreaturesByIdentifier(creatureIdentifier, creaturesInBattle);
}
}
开发者ID:damy90,项目名称:Telerik-all,代码行数:33,代码来源:ExtaenedBatleManager.cs
示例5: ChangeDamageWhenAttacking
public virtual decimal ChangeDamageWhenAttacking(
ICreaturesInBattle attackerWithSpecialty,
ICreaturesInBattle defender,
decimal currentDamage)
{
return currentDamage;
}
开发者ID:EBojilova,项目名称:CSharp-OOP-June-2015,代码行数:7,代码来源:Specialty.cs
示例6: ChangeDamageWhenAttacking
public override decimal ChangeDamageWhenAttacking(
ICreaturesInBattle attackerWithSpecialty,
ICreaturesInBattle defender,
decimal currentDamage)
{
if (attackerWithSpecialty == null)
{
throw new ArgumentNullException("attackerWithSpecialty");
}
if (defender == null)
{
throw new ArgumentNullException("defender");
}
if (this.rounds <= 0)
{
// Effect expires after fixed number of rounds
// Perhaps in this case the most correct way is to invoke base method
// return base.ChangeDamageWhenAttacking(attackerWithSpecialty, defender, currentDamage);
return currentDamage;
}
else
{
this.rounds--;
return currentDamage * 2;
}
}
开发者ID:antonpopov,项目名称:TelerikAcademy,代码行数:30,代码来源:DoubleDamage.cs
示例7: ApplyWhenAttacking
public override void ApplyWhenAttacking(ICreaturesInBattle attackerWithSpecialty, ICreaturesInBattle defender)
{
if (roundsRemaining <= 0)
return;
attackerWithSpecialty.CurrentAttack *= 2;
roundsRemaining--;
}
开发者ID:LyuboslavLyubenov,项目名称:OOP,代码行数:8,代码来源:DoubleAttackWhenAttacking.cs
示例8: AddCreaturesByIdentifier
protected override void AddCreaturesByIdentifier(CreatureIdentifier creatureIdentifier, ICreaturesInBattle creaturesInBattle)
{
if (creatureIdentifier.ArmyNumber == 3)
{
this.thirdArmyCreatues.Add(creaturesInBattle);
}
base.AddCreaturesByIdentifier(creatureIdentifier, creaturesInBattle);
}
开发者ID:enchev-93,项目名称:Telerik-Academy,代码行数:9,代码来源:BattleManagerExtension.cs
示例9: AddCreaturesByIdentifier
protected override void AddCreaturesByIdentifier(CreatureIdentifier creatureIdentifier, ICreaturesInBattle creaturesInBattle)
{
if (creatureIdentifier.ArmyNumber == 1)
{
this.FirstArmyCreatures.Add(creaturesInBattle);
}
else if (creatureIdentifier.ArmyNumber == 2)
{
this.SecondArmyCreatures.Add(creaturesInBattle);
}
}
开发者ID:Xristinaaaa,项目名称:Telerik2016,代码行数:11,代码来源:MockedBattleManager.cs
示例10: ApplyOnSkip
public override void ApplyOnSkip(ICreaturesInBattle skipCreature)
{
if (skipCreature == null)
{
throw new ArgumentNullException("skipCreature");
}
skipCreature.PermanentAttack += this.attackToAdd;
// I don't remove invoking base method, because in future could be added some different logic.
base.ApplyOnSkip(skipCreature);
}
开发者ID:antonpopov,项目名称:TelerikAcademy,代码行数:12,代码来源:AddAttackWhenSkip.cs
示例11: ApplyAfterDefending
public override void ApplyAfterDefending(ICreaturesInBattle defenderWithSpecialty)
{
if (defenderWithSpecialty == null)
{
throw new ArgumentNullException("defenderWithSpecialty");
}
if (defenderWithSpecialty.TotalHitPoints > 0)
{
defenderWithSpecialty.TotalHitPoints = defenderWithSpecialty.Count
* defenderWithSpecialty.Creature.HealthPoints;
}
}
开发者ID:VictorGeorgiev,项目名称:Telerik-Software-Academy,代码行数:13,代码来源:Resurrection.cs
示例12: ApplyWhenAttacking
public override void ApplyWhenAttacking(ICreaturesInBattle attackerWithSpecialty, ICreaturesInBattle defender)
{
if (attackerWithSpecialty == null)
{
throw new ArgumentNullException("attackerWithSpecialty");
}
if (defender == null)
{
throw new ArgumentNullException("defender");
}
var reduceDefenseBy = (int)(defender.CurrentDefense * (this.Percentage / 100.0M));
defender.CurrentDefense = defender.CurrentDefense - reduceDefenseBy;
}
开发者ID:Xristinaaaa,项目名称:Telerik2016,代码行数:15,代码来源:ReduceEnemyDefenseByPercentage.cs
示例13: ApplyWhenAttacking
public override void ApplyWhenAttacking(ICreaturesInBattle attackerWithSpecialty, ICreaturesInBattle defender)
{
if (attackerWithSpecialty == null)
{
throw new ArgumentNullException("attackerWithSpecialty");
}
if (defender == null)
{
throw new ArgumentNullException("defender");
}
this.rounds--;
attackerWithSpecialty.CurrentAttack *= 2;
//defender.CurrentAttack *= 2;
}
开发者ID:VDGone,项目名称:TelerikAcademy-1,代码行数:15,代码来源:DoubleAttackWhenAttacking.cs
示例14: ChangeDamageWhenAttacking
public override decimal ChangeDamageWhenAttacking(ICreaturesInBattle attackerWithSpecialty, ICreaturesInBattle defender,
decimal currentDamage)
{
if (attackerWithSpecialty == null)
{
throw new ArgumentNullException("attackerWithSpecialty");
}
if (rounds==0)
{
return currentDamage;
}
currentDamage *= 2;
rounds--;
return currentDamage;
}
开发者ID:GeorgiDyulgerov,项目名称:ObjectOrientedProgrammingCSharp,代码行数:16,代码来源:DoubleDamage.cs
示例15: AddCreaturesByIdentifier
protected override void AddCreaturesByIdentifier(CreatureIdentifier creatureIdentifier, ICreaturesInBattle creaturesInBattle)
{
try
{
base.AddCreaturesByIdentifier(creatureIdentifier, creaturesInBattle);
}
catch (ArgumentOutOfRangeException e)
{
if (creatureIdentifier.ArmyNumber == 3)
{
this.thirdArmyCreatures.Add(creaturesInBattle);
}
else
{
throw new ArgumentException(e.Message);
}
}
}
开发者ID:LyuboslavLyubenov,项目名称:OOP,代码行数:18,代码来源:ExtendedBattleManager.cs
示例16: ChangeDamageWhenAttacking
public override decimal ChangeDamageWhenAttacking(ICreaturesInBattle attackerWithSpecialty, ICreaturesInBattle defender,
decimal currentDamage)
{
if (attackerWithSpecialty == null)
{
throw new ArgumentNullException("attackerWithSpecialty");
}
if (defender == null)
{
throw new ArgumentNullException("defender");
}
if (NumberOfRounds <= 0)
{
return currentDamage;
}
this.NumberOfRounds --;
return currentDamage;
}
开发者ID:zlatkovtv,项目名称:SoftUni_OOP,代码行数:19,代码来源:DoubleDamage.cs
示例17: ChangeDamageWhenAttacking
public override decimal ChangeDamageWhenAttacking(ICreaturesInBattle attackerWithSpecialty, ICreaturesInBattle defender, decimal currentDamage)
{
if (attackerWithSpecialty == null)
{
throw new ArgumentNullException("attackerWithSpecialty");
}
if (defender == null)
{
throw new ArgumentNullException("defender");
}
if (defender.Creature.GetType() == this.creatureTypeToHate)
{
return currentDamage * 1.5M;
}
return currentDamage;
}
开发者ID:b-slavov,项目名称:Telerik-Software-Academy,代码行数:19,代码来源:Hate.cs
示例18: ApplyWhenAttacking
public override void ApplyWhenAttacking(ICreaturesInBattle attackerWithSpecialty, ICreaturesInBattle defender)
{
if (attackerWithSpecialty == null)
{
throw new ArgumentNullException("attackerWithSpecialty");
}
if (defender == null)
{
throw new ArgumentNullException("defender");
}
if (this.rounds <= 0)
{
// Effect expires after fixed number of rounds
return;
}
attackerWithSpecialty.CurrentAttack *= 2;
this.rounds--;
}
开发者ID:vot24100,项目名称:Telerik-Academy-Homeworks,代码行数:19,代码来源:DoubleAttackWhenAttacking.cs
示例19: AddCreaturesByIdentifier
protected override void AddCreaturesByIdentifier(CreatureIdentifier creatureIdentifier, ICreaturesInBattle creaturesInBattle)
{
if (creatureIdentifier == null)
{
throw new ArgumentNullException("creatureIdentifier");
}
if (creaturesInBattle == null)
{
throw new ArgumentNullException("creaturesInBattle");
}
if (creatureIdentifier.ArmyNumber == 3)
{
this.thirdArmyCreatures.Add(creaturesInBattle);
return;
}
base.AddCreaturesByIdentifier(creatureIdentifier, creaturesInBattle);
}
开发者ID:monikaBchvarova,项目名称:C-Sharp,代码行数:20,代码来源:BattleManagerExtended.cs
示例20: DealDamage
public void DealDamage(ICreaturesInBattle defender)
{
if (defender == null)
{
throw new ArgumentNullException("defender");
}
// Calculate bonus for damage
decimal attackBonus = 1.00M; // Initially 100%
if (this.CurrentAttack > defender.CurrentDefense)
{
attackBonus += 0.05M * (this.CurrentAttack - defender.CurrentDefense);
}
// Calculate damage
decimal damageToMake = this.Creature.Damage * this.Count;
damageToMake = damageToMake * attackBonus;
// Apply battle effects for damage (ChangeDamageWhenAttacking)
foreach (var speciallity in this.Creature.Specialties)
{
damageToMake = speciallity.ChangeDamageWhenAttacking(this, defender, damageToMake);
}
// Calculate damage reductions
if (defender.CurrentDefense > this.CurrentAttack)
{
decimal reduceDamage = 0.025M * (defender.CurrentDefense - this.CurrentAttack);
if (reduceDamage > 0.7M)
{
reduceDamage = 0.7M;
}
damageToMake = damageToMake * (1M - reduceDamage);
}
this.lastDamage = damageToMake;
defender.TotalHitPoints -= (int)damageToMake;
}
开发者ID:Vesko1,项目名称:Exams,代码行数:39,代码来源:CreaturesInBattle.cs
注:本文中的ICreaturesInBattle类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论