本文整理汇总了C#中ICreaturesInBattle类的典型用法代码示例。如果您正苦于以下问题:C# ICreaturesInBattle类的具体用法?C# ICreaturesInBattle怎么用?C# ICreaturesInBattle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ICreaturesInBattle类属于命名空间,在下文中一共展示了ICreaturesInBattle类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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);
}
示例3: ApplyOnSkip
public override void ApplyOnSkip(ICreaturesInBattle skipCreature)
{
if (skipCreature == null)
{
throw new NullReferenceException("skipCreature");
}
}
示例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);
}
}
示例5: ChangeDamageWhenAttacking
public virtual decimal ChangeDamageWhenAttacking(
ICreaturesInBattle attackerWithSpecialty,
ICreaturesInBattle defender,
decimal currentDamage)
{
return currentDamage;
}
示例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;
}
}
示例7: ApplyWhenAttacking
public override void ApplyWhenAttacking(ICreaturesInBattle attackerWithSpecialty, ICreaturesInBattle defender)
{
if (roundsRemaining <= 0)
return;
attackerWithSpecialty.CurrentAttack *= 2;
roundsRemaining--;
}
示例8: AddCreaturesByIdentifier
protected override void AddCreaturesByIdentifier(CreatureIdentifier creatureIdentifier, ICreaturesInBattle creaturesInBattle)
{
if (creatureIdentifier.ArmyNumber == 3)
{
this.thirdArmyCreatues.Add(creaturesInBattle);
}
base.AddCreaturesByIdentifier(creatureIdentifier, creaturesInBattle);
}
示例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);
}
}
示例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);
}
示例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;
}
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
}
}