Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- script typedef ffc class;
- class script enemy
- {
- void run(){}
- void draw(npc n, int offset)
- {
- npcdata nd = Game->LoadNPCData(n->ID);
- //get npcdta tile information
- //draw tileblocks
- }
- bool animate(npc n, int effect)
- {
- //drawing of special effects
- int ofs = 0;
- switch(effect)
- {
- //cases, attack, spell, and so forth, as modifiers to draw()
- //these will assign values to ofs;
- default: break;
- }
- draw(n,ofs);
- }
- int intelligence(npc n)
- {
- int id = n->ID;
- int action = determine_action(id);
- switch(action)
- {
- case ATTACK:
- {
- int atk = choose_attack(id);
- int target = choose_target();
- attack(target);
- break;
- }
- case SPELL:
- {
- int sp = choose_spell(id);
- int target = choose_target();
- case(sp,target);
- }
- case RUN: try_runaway(id); break;
- case DEFEND: parry(id); break;
- default: break;
- }
- }
- int choose_attack(int id)
- {
- int attacklist[16]; npcdata nd = Game->LoadNPCData(id);
- int listPos = 0;
- for ( int q = npcATTACK_MIN; q < npcATTACK_MAX; ++q)
- {
- if (nd->Attributes[q] > 0 ) attacklist[listPos] = nd->Attributes[q];
- ++listPos;
- }
- return attackList[Rand(0,listPos)];
- }
- int choose_spell(int id)
- {
- int attacklist[16]; npcdata nd = Game->LoadNPCData(id);
- int listPos = 0;
- for ( int q = npcSPELL_MIN; q < npcSPELL_MAX; ++q)
- {
- if (nd->Attributes[q] > 0 ) attacklist[listPos] = nd->Attributes[q];
- ++listPos;
- }
- return attackList[Rand(0,listPos)];
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement