-
Notifications
You must be signed in to change notification settings - Fork 1
Saturday Sessions: 20240803 Combat
Joshua Wierenga edited this page Aug 28, 2024
·
3 revisions
You find yourself surrounded.
You swung at enemy 1 with your sword, they tried to dodge but you still hit them.
Enemy 1 launched a fireball at you, ...
Enemy 2 tried to hit you with their sword but missed.
Enemy 3 swung at you with their sword and struck your shoulder.
Recent Moves:
⬤ Enemy 3 did 9 physical damage to you
⬤ Enemy 2 missed
⬤ Enemy 1 did 4 magic damage to you
⬤ You attacked enemy 1 for 3 damage
⬤ Enemy 3 did 9 physical damage to you
⬤ Enemy 2 missed
⬤ Enemy 1 did 4 magic damage to you
⬤ You attacked enemy 1 for 3 damage
Your Health: ███████ : 70%
Your Stamina: ████ : 40%
Enemy 1 Health: ███████ : 70%
Enemy 1 Stamina: ████ : 40%
Enemy 2 Health: ███████ : 70%
Enemy 2 Stamina: ████ : 40%
Enemy 3 Health: ███████ : 70%
Enemy 3 Stamina: ████ : 40%
Use the numbers below to make a selection.
1. Primary Attack
2. Secondary Attack
3. Check Player Stats
4. Flee
list of things to create combat strings:
-
damage
-
descriptor of attack (sliced, bludgeoned, etc.)
-
weapon name?
-
damage type
-
enemy name
-
player name???
-
if dodged?
struct DynStr {
char *str;
size_t len;
}
struct DynStr *DynStrNew(Arena *arena) {
struct DynStr *str = arena_malloc(arena, sizeof(*str));
if (!str) {
return NULL;
}
str.len = 16;
str.str = arena_malloc(arena, str.len);
if (!str.str) {
free(str);
return NULL;
}
str->str[0] = '\0';
return str;
}
bool DynStrCat(Arena *arena, struct DynStr *existingStr, const char *newStr) {
size_t existingStrLen = strlen(existingStr->str);
size_t newStrLen = strlen(newStr);
size_t requiredLen = existingStrLen + newStrLen + 1;
if (requiredLen > existingStr.len) {
char *newNewStr = arena_realloc(arena, existingStr->str, 2 * requiredLen);
if (!newNewStr) {
return false;
}
existingStr->str = newStr;
existingStr->len = 2 * requiredLen;
}
memcpy(existingStr.str + existingStrLen, newStr, newStrLen + 1);
return true;
}