Browse Source

prod: created new function checkStatus

remotes/origin/nextcycle
Kai Kehres 2 years ago
parent
commit
1e32d9cce6
  1. 40
      src/c/character.c
  2. 2
      src/c/character.h
  3. 1
      src/c/spell.h

40
src/c/character.c

@ -3,6 +3,7 @@
#include <string.h> #include <string.h>
#include "character.h" #include "character.h"
#include "spell.h"
Character character; Character character;
@ -294,4 +295,43 @@ Item * getItemInInventory (Character *character, int inventorySlot) {
} else { } else {
return character->inventory[inventorySlot]; return character->inventory[inventorySlot];
} }
}
int checkStatus (Character *character) {
switch (character->status)
{
case SPELL_EFFECT_NONE:
break;
case SPELL_EFFECT_BURN:
setCharacterStatusDuration(character,getCharacterStatusDuration(character)-1);
if (getCharacterStatusDuration == 0) {
setCharacterStatus(character,SPELL_EFFECT_NONE);
}
return getCharacterStatus(character);
break;
case SPELL_EFFECT_FREEZE:
setCharacterStatusDuration(character,getCharacterStatusDuration(character)-1);
if (getCharacterStatusDuration == 0) {
setCharacterStatus(character,SPELL_EFFECT_NONE);
}
return getCharacterStatus(character);
break;
case SPELL_EFFECT_STUN:
setCharacterStatusDuration(character,getCharacterStatusDuration(character)-1);
if (getCharacterStatusDuration == 0) {
setCharacterStatus(character,SPELL_EFFECT_NONE);
}
return getCharacterStatus(character);
break;
case SPELL_EFFECT_REGENERATION:
setCharacterStatusDuration(character,getCharacterStatusDuration(character)-1);
if (getCharacterStatusDuration == 0) {
setCharacterStatus(character,SPELL_EFFECT_NONE);
}
return getCharacterStatus(character);
break;
default:
return getCharacterStatus(character);
break;
}
} }

2
src/c/character.h

@ -134,4 +134,6 @@ int getCharacterStatus (Character *character);
void setCharacterStatusDuration (Character *character, int newStatusDuration); void setCharacterStatusDuration (Character *character, int newStatusDuration);
int getCharacterStatusDuration (Character *character); int getCharacterStatusDuration (Character *character);
int checkStatus (Character *character);
#endif #endif

1
src/c/spell.h

@ -1,7 +1,6 @@
#ifndef SPELL_H #ifndef SPELL_H
#define SPELL_H #define SPELL_H
#include "character.h"
typedef struct { typedef struct {
int damage, healing, manaCost, effect, effectDuration; int damage, healing, manaCost, effect, effectDuration;

Loading…
Cancel
Save