]> git.jsancho.org Git - lugaru.git/commitdiff
Added hasClaws property for PersonType
authorCôme Chilliet <come@chilliet.eu>
Fri, 21 Apr 2017 07:34:48 +0000 (09:34 +0200)
committerCôme Chilliet <come@chilliet.eu>
Fri, 21 Apr 2017 07:35:23 +0000 (09:35 +0200)
Source/Objects/Person.cpp
Source/Objects/PersonType.cpp
Source/Objects/PersonType.hpp

index 1187fb7ba76a6d3db2e29c4ece4ba1db35b17ebc..ff699a1cae6109729496d30d7a3f06130250d029 100644 (file)
@@ -2090,8 +2090,7 @@ void Person::DoAnimations()
                     if (victim->aitype == gethelptype) {
                         victim->DoDamage(victim->damagetolerance - victim->damage);
                     }
-                    //victim->DoDamage(30);
-                    if (creature == wolftype) {
+                    if (PersonType::types[creature].hasClaws) {
                         DoBloodBig(0, 255);
                         emit_sound_at(clawslicesound, victim->coords);
                         victim->spurt = 1;
@@ -2446,17 +2445,17 @@ void Person::DoAnimations()
                         if (id == 0) {
                             camerashake += .4;
                         }
-                        if (Random() % 2 || creature == wolftype) {
+                        if (Random() % 2 || PersonType::types[creature].hasClaws) {
                             victim->spurt = 1;
                             DoBlood(.2, 250);
-                            if (creature == wolftype) {
+                            if (PersonType::types[creature].hasClaws) {
                                 DoBloodBig(0, 250);
                             }
                         }
                         if (!Tutorial::active) {
                             emit_sound_at(heavyimpactsound, victim->coords, 128.);
                         }
-                        if (creature == wolftype) {
+                        if (PersonType::types[creature].hasClaws) {
                             emit_sound_at(clawslicesound, victim->coords, 128.);
                             victim->spurt = 1;
                             victim->DoBloodBig(2 / victim->armorhead, 175);
@@ -2484,14 +2483,14 @@ void Person::DoAnimations()
                         if (id == 0) {
                             camerashake += .4;
                         }
-                        if (Random() % 2 || creature == wolftype) {
+                        if (Random() % 2 || PersonType::types[creature].hasClaws) {
                             victim->spurt = 1;
-                            if (creature == wolftype) {
+                            if (PersonType::types[creature].hasClaws) {
                                 DoBloodBig(0, 235);
                             }
                         }
                         emit_sound_at(whooshhitsound, victim->coords);
-                        if (creature == wolftype) {
+                        if (PersonType::types[creature].hasClaws) {
                             emit_sound_at(clawslicesound, victim->coords, 128.);
                             victim->spurt = 1;
                             victim->DoBloodBig(2, 175);
@@ -2524,7 +2523,7 @@ void Person::DoAnimations()
                         if (!Tutorial::active) {
                             emit_sound_at(heavyimpactsound, victim->coords, 160.);
                         }
-                        if (creature == wolftype) {
+                        if (PersonType::types[creature].hasClaws) {
                             emit_sound_at(clawslicesound, victim->coords, 128.);
                             victim->spurt = 1;
                             victim->DoBloodBig(2 / victim->armorhead, 175);
@@ -2561,7 +2560,7 @@ void Person::DoAnimations()
                         if (!Tutorial::active) {
                             emit_sound_at(heavyimpactsound, victim->coords, 160.);
                         }
-                        if (creature == wolftype) {
+                        if (PersonType::types[creature].hasClaws) {
                             emit_sound_at(clawslicesound, victim->coords, 128.);
                             victim->spurt = 1;
                             victim->DoBloodBig(2 / victim->armorhead, 175);
@@ -3202,7 +3201,7 @@ void Person::DoAnimations()
                             if (id == 0) {
                                 camerashake += .4;
                             }
-                            if (Random() % 2 || creature == wolftype) {
+                            if (Random() % 2 || PersonType::types[creature].hasClaws) {
                                 victim->spurt = 1;
                             }
                             emit_sound_at(staffheadsound, victim->coords);
@@ -3237,7 +3236,7 @@ void Person::DoAnimations()
                             if (id == 0) {
                                 camerashake += .4;
                             }
-                            if (Random() % 2 || creature == wolftype) {
+                            if (Random() % 2 || PersonType::types[creature].hasClaws) {
                                 victim->spurt = 1;
                             }
                             emit_sound_at(staffheadsound, victim->coords);
@@ -3272,7 +3271,7 @@ void Person::DoAnimations()
                             if (id == 0) {
                                 camerashake += .4;
                             }
-                            if (Random() % 2 || creature == wolftype) {
+                            if (Random() % 2 || PersonType::types[creature].hasClaws) {
                                 victim->spurt = 1;
                             }
                             emit_sound_at(staffbodysound, victim->coords);
@@ -3345,7 +3344,7 @@ void Person::DoAnimations()
                             if (victim->howactive == typesleeping) {
                                 victim->DoDamage(damagemult * 150 / victim->protectionhead);
                             }
-                            if (creature == wolftype) {
+                            if (PersonType::types[creature].hasClaws) {
                                 emit_sound_at(clawslicesound, victim->coords, 128.);
                                 victim->spurt = 1;
                                 victim->DoBloodBig(2 / victim->armorhead, 175);
@@ -3367,7 +3366,7 @@ void Person::DoAnimations()
                             }
                             victim->Puff(abdomen);
                             victim->DoDamage(damagemult * 30 / victim->protectionhigh);
-                            if (creature == wolftype) {
+                            if (PersonType::types[creature].hasClaws) {
                                 emit_sound_at(clawslicesound, victim->coords, 128.);
                                 victim->spurt = 1;
                                 victim->DoBloodBig(2 / victim->armorhigh, 170);
@@ -3450,7 +3449,7 @@ void Person::DoAnimations()
                     if (!Tutorial::active) {
                         emit_sound_at(heavyimpactsound, victim->coords, 128.);
                     }
-                    if (creature == wolftype) {
+                    if (PersonType::types[creature].hasClaws) {
                         emit_sound_at(clawslicesound, victim->coords, 128);
                         victim->spurt = 1;
                         victim->DoBloodBig(2 / victim->armorhigh, 170);
@@ -3562,17 +3561,17 @@ void Person::DoAnimations()
                     award_bonus(id, Reversal);
 
                     bool doslice;
-                    doslice = 0;
-                    if (weaponactive != -1 || creature == wolftype) {
-                        doslice = 1;
-                    }
-                    if (creature == rabbittype && weaponactive != -1) {
-                        if (weapons[weaponids[0]].getType() == staff) {
-                            doslice = 0;
-                        }
+                    if (weaponactive == -1) {
+                        doslice = PersonType::types[creature].hasClaws;
+                    } else {
+                        doslice = (weapons[weaponids[0]].getType() != staff);
                     }
                     if (doslice) {
-                        if (weaponactive != -1) {
+                        if (weaponactive == -1) {
+                            emit_sound_at(clawslicesound, victim->coords, 128.);
+                            victim->spurt = 1;
+                            victim->DoBloodBig(2 / victim->armorhigh, 175);
+                        } else {
                             victim->DoBloodBig(2 / victim->armorhigh, 225);
                             emit_sound_at(knifeslicesound, victim->coords);
                             if (bloodtoggle && !weapons[weaponids[weaponactive]].bloody) {
@@ -3580,11 +3579,6 @@ void Person::DoAnimations()
                             }
                             weapons[weaponids[weaponactive]].blooddrip += 3;
                         }
-                        if (weaponactive == -1 && creature == wolftype) {
-                            emit_sound_at(clawslicesound, victim->coords, 128.);
-                            victim->spurt = 1;
-                            victim->DoBloodBig(2 / victim->armorhigh, 175);
-                        }
                     }
                 }
 
@@ -3656,17 +3650,17 @@ void Person::DoAnimations()
                     victim->damage = victim->damagetolerance;
                     victim->permanentdamage = victim->damagetolerance - 1;
                     bool doslice;
-                    doslice = 0;
-                    if (weaponactive != -1 || creature == wolftype) {
-                        doslice = 1;
-                    }
-                    if (creature == rabbittype && weaponactive != -1) {
-                        if (weapons[weaponids[0]].getType() == staff) {
-                            doslice = 0;
-                        }
+                    if (weaponactive == -1) {
+                        doslice = PersonType::types[creature].hasClaws;
+                    } else {
+                        doslice = (weapons[weaponids[0]].getType() != staff);
                     }
                     if (doslice) {
-                        if (weaponactive != -1) {
+                        if (weaponactive == -1) {
+                            emit_sound_at(clawslicesound, victim->coords, 128.);
+                            victim->spurt = 1;
+                            victim->DoBloodBig(2, 175);
+                        } else {
                             victim->DoBloodBig(200, 225);
                             emit_sound_at(knifeslicesound, victim->coords);
                             if (bloodtoggle) {
@@ -3674,12 +3668,6 @@ void Person::DoAnimations()
                             }
                             weapons[weaponids[weaponactive]].blooddrip += 5;
                         }
-
-                        if (creature == wolftype && weaponactive == -1) {
-                            emit_sound_at(clawslicesound, victim->coords, 128.);
-                            victim->spurt = 1;
-                            victim->DoBloodBig(2, 175);
-                        }
                     }
                     award_bonus(id, spinecrusher);
                 }
@@ -3833,17 +3821,17 @@ void Person::DoAnimations()
                         }
                     }
                     bool doslice;
-                    doslice = 0;
-                    if (weaponactive != -1 || creature == wolftype) {
-                        doslice = 1;
-                    }
-                    if (creature == rabbittype && weaponactive != -1) {
-                        if (weapons[weaponids[0]].getType() == staff) {
-                            doslice = 0;
-                        }
+                    if (weaponactive == -1) {
+                        doslice = PersonType::types[creature].hasClaws;
+                    } else {
+                        doslice = (weapons[weaponids[0]].getType() != staff);
                     }
                     if (doslice) {
-                        if (weaponactive != -1) {
+                        if (weaponactive == -1) {
+                            emit_sound_at(clawslicesound, victim->coords, 128.);
+                            victim->spurt = 1;
+                            victim->DoBloodBig(2 / victim->armorhead, 175);
+                        } else {
                             victim->DoBloodBig(2 / victim->armorhead, 225);
                             emit_sound_at(knifeslicesound, victim->coords);
                             if (bloodtoggle && !weapons[weaponids[weaponactive]].bloody) {
@@ -3851,11 +3839,6 @@ void Person::DoAnimations()
                             }
                             weapons[weaponids[weaponactive]].blooddrip += 3;
                         }
-                        if (weaponactive == -1 && creature == wolftype) {
-                            emit_sound_at(clawslicesound, victim->coords, 128.);
-                            victim->spurt = 1;
-                            victim->DoBloodBig(2 / victim->armorhead, 175);
-                        }
                     }
 
                     award_bonus(id, Reversal);
index 3dc4df83bbcb0ceebdbaea6832793347fbfb3816..3dd392842d63bc2edbf5b604dc12bcbe2285f46b 100644 (file)
@@ -78,6 +78,7 @@ void PersonType::Load()
     types[wolftype].power = 2.5;
     types[wolftype].defaultDamageTolerance = 300;
     types[wolftype].defaultScale = .23;
+    types[wolftype].hasClaws = true;
 
     /* Rabbit */
     types[rabbittype].proportions[0] = 1.2;
@@ -131,4 +132,5 @@ void PersonType::Load()
     types[rabbittype].power = 1;
     types[rabbittype].defaultDamageTolerance = 200;
     types[rabbittype].defaultScale = .2;
+    types[rabbittype].hasClaws = false;
 }
index 09333ba4d61144a8b70303cc94d4183fbbe31312..e39e4548472b1eae403e623d27ba3791bef61d9c 100644 (file)
@@ -60,6 +60,7 @@ public:
     float power;
     unsigned int defaultDamageTolerance;
     float defaultScale;
+    bool hasClaws;
 
     GLubyte bloodText[512 * 512 * 3] = { 0 };