aboutsummaryrefslogtreecommitdiff
path: root/src/crcombat.cc
diff options
context:
space:
mode:
authorfusion32 <marcopuzziello@gmail.com>2025-05-31 22:18:08 -0300
committerfusion32 <marcopuzziello@gmail.com>2025-05-31 22:20:44 -0300
commitc4b06256d92408c4e99bd37b58d66f2024ec0a70 (patch)
treee93b6861520fddd0f49f765dd9dd83058fc80b31 /src/crcombat.cc
parentd7c11b271633ee1f5b58d2b679b50cf95b2826e0 (diff)
downloadgame-c4b06256d92408c4e99bd37b58d66f2024ec0a70.tar.gz
game-c4b06256d92408c4e99bd37b58d66f2024ec0a70.zip
impl TCreature::Damage + overall improvements
Diffstat (limited to 'src/crcombat.cc')
-rw-r--r--src/crcombat.cc30
1 files changed, 19 insertions, 11 deletions
diff --git a/src/crcombat.cc b/src/crcombat.cc
index 7ad7534..2843cd3 100644
--- a/src/crcombat.cc
+++ b/src/crcombat.cc
@@ -839,10 +839,17 @@ void TCombat::DistanceAttack(TCreature *Target){
ANIMATION_NONE, 2, &Impact, EFFECT_BURST_ARROW);
}
- if(random(0, 99) < Fragility){
- Delete(this->Ammo, 1);
- }else{
- Move(0, this->Ammo, DropCon, 1, false, NONE);
+ try{
+ if(random(0, 99) < Fragility){
+ Delete(this->Ammo, 1);
+ }else{
+ Move(0, this->Ammo, DropCon, 1, false, NONE);
+ }
+ }catch(RESULT err){
+ if(err != DESTROYED){
+ error("TCombat::RangeAttack: Konnte Ammo nicht verschieben/löschen"
+ " (Exception %d, [%d,%d,%d].\n", err, DropX, DropY, DropZ);
+ }
}
if(!Hit){
@@ -918,11 +925,12 @@ void TCombat::DistributeExperiencePoints(uint32 Exp){
int MasterLevel = Master->Skills[SKILL_LEVEL]->Get();
int AttackerLevel = Attacker->Skills[SKILL_LEVEL]->Get();
int MaxLevel = (MasterLevel * 11) / 10;
- if(AttackerLevel < MaxLevel){
- Amount = ((MaxLevel - AttackerLevel) * Amount) / MasterLevel;
- }else{
- Amount = 0;
- }
+ if(AttackerLevel <= MaxLevel){
+ continue;
+ }
+
+ Amount = ((MaxLevel - AttackerLevel) * Amount) / MasterLevel;
+ print(3, "%s erhält %d EXP.\n", Attacker->Name, Amount);
}
if(Amount > 0){
@@ -944,8 +952,8 @@ void TCombat::DistributeExperiencePoints(uint32 Exp){
}
}
- Attacker->Skills[0]->Increase(Amount);
- TextualEffect(Attacker->CrObject, 0xD7, "%d", Amount);
+ Attacker->Skills[SKILL_LEVEL]->Increase(Amount);
+ TextualEffect(Attacker->CrObject, COLOR_WHITE, "%d", Amount);
}
}
}