Skip to content

Conversation

@LiquidityC
Copy link
Member

@LiquidityC LiquidityC commented Oct 10, 2025

Summary by CodeRabbit

  • New Features

    • Bash skill now displays a contextual tooltip for clearer feedback.
    • Added a new Shield Bash animation with a polished 7‑frame sequence, improved looping, accurate sprite sizing, clipping, and rotation pivot for smoother visuals.
  • Enhancements

    • More cohesive UI/animation integration for the Bash skill, providing clearer on-screen feedback during use.

@coderabbitai
Copy link

coderabbitai bot commented Oct 10, 2025

Walkthrough

The Bash skill creation now accepts a Camera pointer and initializes tooltip and animation assets. The call site in skill_create is updated accordingly. Animation setup uses "Extras/ShieldBash.png" with defined frames and properties. A previous animation_run call in skill_bash is removed. No other public interfaces are changed.

Changes

Cohort / File(s) Summary of Changes
Skill creation and animation wiring
src/skill.c
Updated create_bash signature to create_bash(Camera *cam) and adjusted call in skill_create. Added tooltip initialization with bash_tooltip(cam) and configured a new Animation using "Extras/ShieldBash.png" (7 frames, sprite dimensions, clip, loop, rotation point). Removed animation_run(data->player->swordAnimation) from skill_bash.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Game as Game Loop
  participant Skills as skill_create(t, cam)
  participant Bash as create_bash(cam)
  participant UI as Tooltip
  participant Anim as Animation

  Game->>Skills: Request create Skill(BASH, cam)
  Skills->>Bash: create_bash(cam)
  Bash->>UI: init bash_tooltip(cam)
  Bash->>Anim: load "Extras/ShieldBash.png"
  Bash->>Anim: configure frames, loop, sprite dim, clip, rotation point
  Bash-->>Skills: return Skill{ tooltip, animation }
  Skills-->>Game: Skill instance

  note over Game,Skills: During use: removed direct sword animation_run call in skill_bash
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Poem

A bash of shields, a flash on screen,
I hop through code where frames convene.
With camera in paw, I link the cue,
Tooltip whispers what to do.
No sword to run—just bash and gleam,
A rabbit frames the perfect scene. 🛡️🐇✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title succinctly describes the main change, namely the addition of a new shield bash animation, and aligns directly with the modifications in skill.c where create_bash now sets up the animation and assets for the shield bash skill. It is clear, specific, and concise, enabling reviewers to understand the primary intent at a glance. There is no extraneous phrasing or unrelated content.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch shield_bash_animation

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@LiquidityC LiquidityC enabled auto-merge (squash) October 10, 2025 10:15
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/skill.c (1)

583-584: Consistency nit: centralize tooltip creation pattern.

Most skills create tooltips in skill_create, but Flurry and Bash do it in their create_* functions. Consider picking one pattern for consistency.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6ca7ad4 and 5fb34b2.

⛔ Files ignored due to path filters (1)
  • assets/Extras/ShieldBash.png is excluded by !**/*.png
📒 Files selected for processing (1)
  • src/skill.c (3 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/skill.c (2)
src/tooltip.c (1)
  • tooltip_create (122-129)
src/animation.c (3)
  • animation_create (25-37)
  • animation_load_texture (39-43)
  • animation_set_frames (88-94)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
  • GitHub Check: Ubuntu (mingw)
  • GitHub Check: Ubuntu (GCC)
  • GitHub Check: Mac (Clang)
  • GitHub Check: Windows (MSVC)
  • GitHub Check: Ubuntu (Clang)
  • GitHub Check: Mac (GCC)
  • GitHub Check: Analyze (c-cpp)
🔇 Additional comments (3)
src/skill.c (3)

568-576: Creation wiring looks good (tooltip + animation).

Signature change to accept Camera, tooltip creation, and animation setup mirror Flurry’s pattern. Destruction path handles animation/tooltip. LGTM.

Also applies to: 583-601


1083-1083: Call site update matches new signature.

create_bash(cam) aligns with the new create_bash(Camera*) signature.


587-597: Asset present and frame count correct: Extras/ShieldBash.png is 224×32, matching seven 32×32 frames.

Comment on lines +583 to 601
skill->tooltip = tooltip_create(bash_tooltip, cam);
skill->animation = animation_create(7);
Animation *a = skill->animation;

animation_load_texture(a, "Extras/ShieldBash.png", cam->renderer);
animation_set_frames(a, (AnimationClip[]) {
{ 0, 0, 32, 32, 20 },
{ 32, 0, 32, 32, 20 },
{ 64, 0, 32, 32, 20 },
{ 96, 0, 32, 32, 20 },
{ 128, 0, 32, 32, 20 },
{ 160, 0, 32, 32, 20 },
{ 192, 0, 32, 32, 20 },
});
a->loop = false;
a->sprite->dim = GAME_DIMENSION;
a->sprite->clip = (SDL_Rect) { 0, 0, 32, 32 };
a->sprite->rotationPoint = (SDL_Point) { 16, 16 };
return skill;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

New animation is never triggered; run it on use and bind to player.

You set up skill->animation but don’t start it. Unless there’s a framework hook that auto-runs skill animations, the Shield Bash animation won’t play.

Proposed fix: trigger it in skill_bash after check_skill_validity and bind sprite pos/angle to the player.

 static bool
 skill_bash(Skill *skill, SkillData *data)
 {
-	UNUSED (skill);
+	// Run shield bash animation anchored to the player
+	// (after check_skill_validity, so player_turn has set facing/angle)
 
 	Position playerPos, targetPos;
 	if (!check_skill_validity(&playerPos, &targetPos, data)) {
 		return false;
 	}
+
+	if (skill && skill->animation) {
+		Animation *a = skill->animation;
+		a->sprite->pos   = data->player->sprite->pos;
+		a->sprite->angle = data->player->sprite->angle;
+		animation_run(a);
+	}

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In src/skill.c around lines 583 to 601, you create and configure
skill->animation but never start it or bind its sprite to the player, so the
Shield Bash frames never play; modify the skill_bash handler (after the
check_skill_validity return path) to call the animation start function on
skill->animation (e.g., set current frame/time and mark playing or call
animation_play) and set the animation's sprite position and rotationPoint to the
player's sprite position/angle (bind/update on each tick or set a reference) so
the animation is triggered and follows the player when the skill is used.

@LiquidityC LiquidityC merged commit 22d5593 into dev Oct 10, 2025
10 checks passed
@LiquidityC LiquidityC deleted the shield_bash_animation branch October 10, 2025 10:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants