MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame^] | 1 | // MorgenGrauen MUDlib |
| 2 | // |
| 3 | // living/std_skills.c -- Standardfaehigkeiten |
| 4 | // |
| 5 | // $Id: std_skills.c 6673 2008-01-05 20:57:43Z Zesstra $ |
| 6 | #pragma strong_types |
| 7 | #pragma save_types |
| 8 | #pragma range_check |
| 9 | #pragma no_clone |
| 10 | #pragma pedantic |
| 11 | |
| 12 | #define NEED_PROTOTYPES |
| 13 | #include <living/skills.h> |
| 14 | #include <living/skill_attributes.h> |
| 15 | #include <thing/properties.h> |
| 16 | #include <attributes.h> |
| 17 | #undef NEED_PROTOTYPES |
| 18 | #include <properties.h> |
| 19 | #include <new_skills.h> |
| 20 | |
| 21 | #define SIG(x) (x?(x>0?1:-1):0) |
| 22 | |
| 23 | protected int StdSkill_Nightvision(object me, string sname, mixed sinfo) { |
| 24 | int abil,light,llt,dt,res; |
| 25 | |
| 26 | if (!sinfo || !environment()) return 0; |
| 27 | if (intp(sinfo)) sinfo=([SI_SKILLABILITY:sinfo]); |
| 28 | if (!mappingp(sinfo)) return 0; |
| 29 | if ((light=QueryProp(P_PLAYER_LIGHT))>0) { |
| 30 | ModifySkill(sname,([SI_LASTLIGHT:time()])); |
| 31 | return light; |
| 32 | } |
| 33 | abil=sinfo[SI_SKILLABILITY]; |
| 34 | if (!(llt=sinfo[SI_LASTLIGHT])) { |
| 35 | ModifySkill(sname,([SI_LASTLIGHT:time()])); |
| 36 | dt=0; |
| 37 | } else { |
| 38 | dt=time()-llt; |
| 39 | if (dt<0) dt=0; |
| 40 | if (dt>86400) dt=86400; |
| 41 | } |
| 42 | |
| 43 | res=(abil*dt)/(20*MAX_ABILITY)+light; |
| 44 | if (res<=0) { |
| 45 | res--; // Wert muss !=0 sein |
| 46 | if (res<-MAX_ABILITY) res=-MAX_ABILITY; |
| 47 | } else { |
| 48 | if (res>MAX_ABILITY) res=MAX_ABILITY; |
| 49 | } |
| 50 | return res; |
| 51 | } |
| 52 | |
| 53 | protected mapping StdSkill_Bihand(object me, string sname, mapping sinfo) { |
| 54 | int abil,val; |
| 55 | |
| 56 | // printf("Bihand: %O\n",sinfo); |
| 57 | if (!sinfo) return 0; |
| 58 | abil=sinfo[SI_SKILLABILITY]; |
| 59 | val=(abil*(QueryAttribute(A_STR)+33))/MAX_ABILITY; |
| 60 | val=(val*QuerySkillAttribute(SA_DAMAGE))/100; |
| 61 | sinfo[SI_SKILLDAMAGE]+=val; |
| 62 | // + max. 53 |
| 63 | return sinfo; |
| 64 | } |
| 65 | |
| 66 | protected mapping StdSkill_Fight_sword(object me, string sname, mapping sinfo) { |
| 67 | int abil,asig,val; |
| 68 | |
| 69 | abil=sinfo[SI_SKILLABILITY];asig=SIG(abil); |
| 70 | val=(abil*(QueryAttribute(A_STR) + |
| 71 | QueryAttribute(A_DEX)*asig + |
| 72 | 33))/MAX_ABILITY; |
| 73 | val=(val*QuerySkillAttribute(SA_DAMAGE))/100; |
| 74 | sinfo[SI_SKILLDAMAGE]+=val; |
| 75 | // + max. 73 |
| 76 | return sinfo; |
| 77 | } |
| 78 | |
| 79 | protected mapping StdSkill_Fight_hands(object me, string sname, mapping sinfo) { |
| 80 | int abil,asig,val; |
| 81 | |
| 82 | if (!sinfo) return 0; |
| 83 | abil=sinfo[SI_SKILLABILITY];asig=SIG(abil); |
| 84 | val=(abil*(QueryAttribute(A_STR) + |
| 85 | QueryAttribute(A_DEX)*3*asig + |
| 86 | 100))/MAX_ABILITY; |
| 87 | val=(val*QuerySkillAttribute(SA_DAMAGE))/100; |
| 88 | sinfo[SI_SKILLDAMAGE]+=val; |
| 89 | // + max. 180 |
| 90 | return sinfo; |
| 91 | } |
| 92 | |
| 93 | protected int StdSkill_Booze(object me, string sname, mapping sinfo) { |
| 94 | int abil,val; |
| 95 | |
| 96 | val=0; |
| 97 | if (!sinfo || (val=sinfo[SI_SKILLARG])<=0) |
| 98 | return val; |
| 99 | abil=sinfo[SI_SKILLABILITY]; |
| 100 | val-=(val*abil)/(MAX_ABILITY+2500); // Bis zu 80% Abzug bei Alkoholikern. |
| 101 | if (val<=0) val=1; |
| 102 | return val; |
| 103 | } |
| 104 | |