private bool checkCost(Gladiator gladiator, Item item, SlotStuff slotStuff) { uint newCost = gladiator.stuff.getCostAllStuff() + item.cost - gladiator.stuff.getCostItem(slotStuff); // Le total actuel de l'équipement + coût nouveau item - l'item qui sera ramplacé if (newCost > MAX_COST_STUFF) { return false; } return true; }
private Hit hit(Gladiator attacker, Gladiator defenser) { List<SlotStuff> hits = attacker.getSlotByStats(TypeStats.CHANCE_HIT); List<SlotStuff> parries = defenser.getSlotByStats(TypeStats.CHANCE_PARRY); foreach(SlotStuff slotForHit in hits) { uint chanceHit = attacker.chanceHit(slotForHit); if (this.diceRool(chanceHit)) { Console.WriteLine(attacker.name + " réussi son attaque contre " + defenser.name); // Le filet ne peut pas être parré if (attacker.isFilet(slotForHit)) { Console.WriteLine(attacker.name + " lance le filet et réussi"); return Hit.TRAPPED; } foreach (SlotStuff slotForParry in parries) { uint chanceParry = defenser.chanceParry(slotForParry); if (this.diceRool(chanceParry)) { Console.WriteLine(defenser.name + " rate la parade"); return Hit.TOUCH; } } Console.WriteLine(defenser.name + " réussi la parade"); } } Console.WriteLine(attacker.name + " rate son coup"); return Hit.NOPE; }
public bool addGladiator(Gladiator gladiator) { int nbGladiator = this._gladiators.Count; if (nbGladiator >= NB_GLADIATOR_MAX_PER_TEAM) { return false; } this._gladiators.Add(gladiator); return true; }
public bool canEquip(Gladiator gladiator, Item item, SlotStuff slotStuff) { return this.checkSlot(item, slotStuff) && this.checkCost(gladiator, item, slotStuff); }
public Duel(Gladiator gladiatorA, Gladiator gladiatorB) { this._gladiatorA = gladiatorA; this._gladiatorB = gladiatorB; }
private void setEffect(Hit hit, Gladiator gladiator) { switch(hit) { case Hit.TRAPPED: gladiator.debuff = new Trapped(); break; case Hit.TOUCH: gladiator.debuff = new Dead(); break; } }