Advertisement
Guest User

Untitled

a guest
Jun 24th, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.40 KB | None | 0 0
  1. int select_atacker( const Banda *const b ) {
  2.     int pula = 3;
  3.     for( int i=0 ; i<CNT_POSTACI ; i++ ) {
  4.         const Postac *const p = b->postaci + i;
  5.         if( p->live > 0 )
  6.             pula += p->evil * (p->spirit + p->strength);
  7.     }
  8.  
  9.     for( int i=2 ; 1 ; i++ ) {
  10.         const Postac *const p = b->postaci + i%CNT_POSTACI;
  11.         if( p->live > 0 )
  12.             if( p->evil * (p->spirit + p->strength) > my_rand()%pula )
  13.                 return i;
  14.     }
  15.  
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement