Adds the DAGGER_MAGNET artifact

* Adds sprites for volotile and synamite as well
This commit is contained in:
Linus Probert 2019-05-15 20:32:48 +02:00
parent 5e67ca7ef7
commit 2dc25c9b53
8 changed files with 39 additions and 7 deletions

View File

@ -21,7 +21,7 @@ run: $(all)
playtest: $(all)
@LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./ ./_build/release/breakhack
.PHONY: run
.PHONY: playtest
lint:
@make lint -sC _build/debug

BIN
assets/Extras/Artifacts.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 548 B

View File

@ -68,6 +68,11 @@ artifact_set_effect(Artifact *a, MagicalEffect effect)
case SKILL_RADIUS:
a->info.name = "Magic wand";
a->info.desc = "Your magic has greater reach";
break;
case DAGGER_BOUNCE:
a->info.name = "Magnet";
a->info.desc = "You are attractive to daggers";
break;
default:
break;
}
@ -81,7 +86,8 @@ static int WarriorArtifacts[] = {
PUSH_BACK, // 4
FEAR_INDUCING, // 5
INCREASED_STUN, // 6
CHARGE_THROUGH // 7
DAGGER_BOUNCE, // 7
CHARGE_THROUGH // 8
};
static int RogueArtifacts[] = {
@ -92,7 +98,8 @@ static int RogueArtifacts[] = {
PUSH_BACK, // 4
FEAR_INDUCING, // 5
INCREASED_STUN, // 6
PHASE_IMPROVEMENT // 7
DAGGER_BOUNCE, // 7
PHASE_IMPROVEMENT // 8
};
static int MageArtifacts[] = {
@ -103,7 +110,8 @@ static int MageArtifacts[] = {
PUSH_BACK, // 4
FEAR_INDUCING, // 5
INCREASED_STUN, // 6
SKILL_RADIUS // 7
DAGGER_BOUNCE, // 7
SKILL_RADIUS // 8
};
/* Not in play yet */
@ -115,7 +123,8 @@ static int PaladinArtifacts[] = {
PUSH_BACK, // 4
FEAR_INDUCING, // 5
INCREASED_STUN, // 6
SKILL_RADIUS // 7
DAGGER_BOUNCE, // 7
SKILL_RADIUS // 8
};
/* Not in play yet */
@ -127,7 +136,8 @@ static int EngineerArtifacts[] = {
PUSH_BACK, // 4
FEAR_INDUCING, // 5
INCREASED_STUN, // 6
PHASE_IMPROVEMENT // 7
DAGGER_BOUNCE, // 7
PHASE_IMPROVEMENT // 8
};
static void
@ -147,7 +157,7 @@ add_level_sprite(Artifact *a)
Artifact *
artifact_create_random(Player *p, Uint8 level)
{
int option = get_random(7);
int option = get_random(8);
int * artifactPool = NULL;
if (p->class == ROGUE)
@ -239,6 +249,11 @@ artifact_sprite_for(MagicalEffect effect)
sprite_set_texture(sprite, t, 0);
sprite->clip = CLIP16(2*16, 0);
break;
case DAGGER_BOUNCE:
t = texturecache_add("Extras/Artifacts.png");
sprite_set_texture(sprite, t, 0);
sprite->clip = CLIP16(0, 0);
break;
default:
break;
}

View File

@ -31,6 +31,7 @@ typedef enum MagicalEffect {
CHARGE_THROUGH,
PHASE_IMPROVEMENT,
SKILL_RADIUS,
DAGGER_BOUNCE,
LAST_ARTIFACT_EFFECT // Sentinel
} MagicalEffect;

View File

@ -49,6 +49,7 @@ projectile_dagger_create(void)
p->sprite->dim = (Dimension) { 32, 32 };
p->sprite->rotationPoint = (SDL_Point) { 16, 16 };
p->collisionCount = 0;
p->bounceCount = 0;
memset(&p->processedSpaces,
false,
sizeof(p->processedSpaces[0][0]) * MAP_ROOM_WIDTH * MAP_ROOM_HEIGHT);
@ -130,6 +131,10 @@ projectile_update(Projectile *p, UpdateData *data)
player_monster_kill_check(data->player, space->monster);
alive = player_has_artifact(data->player, PIERCING_DAGGERS) > p->collisionCount;
projectilePos = space->monster->sprite->pos;
} else {
p->bounceCount += 1;
vector2d_reverse(&p->velocity);
alive = p->bounceCount < player_has_artifact(data->player, DAGGER_BOUNCE);
}
mixer_play_effect(SWORD_HIT);

View File

@ -36,6 +36,7 @@ typedef struct Projectile {
Timer *lifetime;
bool alive;
Uint32 collisionCount;
Uint32 bounceCount;
bool processedSpaces[MAP_ROOM_WIDTH][MAP_ROOM_HEIGHT];
void (*onRender)(struct Projectile*);
} Projectile;

View File

@ -13,6 +13,13 @@ vector2d_is_opposite(Vector2d v1, Vector2d v2)
|| ((v1.x < 0 && v2.x > 0) ^ (v1.y < 0 && v2.y > 0));
}
void
vector2d_reverse(Vector2d *vec)
{
vec->x *= -1;
vec->y *= -1;
}
Vector2d
vector2d_to_direction(const Vector2d *vec)
{

View File

@ -43,4 +43,7 @@ vector2d_is_opposite(Vector2d, Vector2d);
Vector2d
vector2d_to_direction(const Vector2d*);
void
vector2d_reverse(Vector2d*);
#endif // VECTOR2D_H_