Advertisement
Sosowski

roguelike

Apr 14th, 2012
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.57 KB | None | 0 0
  1. typedef struct STAT
  2. {
  3.   int exp; // expee;
  4.   int lvl; // 99
  5.   int hp; // hors powah!
  6.   int atk; // atttakkk
  7.   int def; //sens defens
  8.   int agl; // agility
  9.   int luk; // luck
  10. } STAT;
  11.  
  12. void attack(STAT* off,STAT* def)
  13. {
  14.   // WHAT DO I PUT HERE HELP!!!
  15.  
  16.   ////// EDIT:
  17.   // ok let's try this!
  18.   int atk,def,diff,bonus,luck;
  19.  
  20.   atk=off->atk;
  21.   def=def->def;
  22.   diff=atk-def;
  23.   if (diff<0) diff=0;
  24.   luck = def->luck-off->luck;
  25.   if (luck<0) luck=0;
  26.   bonus = 1+LUCK(luck,1+rand(8));
  27.   diff*=bonus;
  28.   diff+=(rand()%luck)+1;
  29.   def->hp-=diff;
  30.   /////////////
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement