Skip to content

Commit

Permalink
Fix pr #390: Fix issue #389: Jutsu Level Transfer
Browse files Browse the repository at this point in the history
  • Loading branch information
openhands-agent committed Feb 21, 2025
1 parent 282b9c0 commit 8aa7077
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 9 deletions.
31 changes: 23 additions & 8 deletions app/src/app/jutsus/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -165,25 +165,40 @@ export default function MyJutsu() {
const allJutsu = userJutsus?.map((userjutsu) => {
let warning = "";
if (userData) {
if (!checkJutsuItems(userjutsu.jutsu, userItems)) {
warning = `No ${userjutsu.jutsu.jutsuWeapon.toLowerCase()} weapon equipped.`;
const jutsu: Jutsu = {
...userjutsu.jutsu,
id: userjutsu.jutsuId,
updatedAt: new Date(),
createdAt: new Date(),
statClassification: userjutsu.jutsu.statClassification || "Highest",
cooldown: userjutsu.jutsu.cooldown || 0,
chakraCost: userjutsu.jutsu.chakraCost || 0,
staminaCost: userjutsu.jutsu.staminaCost || 0,
healthCost: userjutsu.jutsu.healthCost || 0,
actionCostPerc: userjutsu.jutsu.actionCostPerc || 0,
extraBaseCost: userjutsu.jutsu.extraBaseCost || 0,
hidden: userjutsu.jutsu.hidden || false,
effects: userjutsu.jutsu.effects || []
};
if (!checkJutsuItems(jutsu, userItems)) {
warning = `No ${jutsu.jutsuWeapon.toLowerCase()} weapon equipped.`;
}
if (!checkJutsuElements(userjutsu.jutsu, userElements)) {
if (!checkJutsuElements(jutsu, userElements)) {
warning = "You do not have the required elements to use this jutsu.";
}
if (!hasRequiredRank(userData.rank, userjutsu.jutsu.requiredRank)) {
if (!hasRequiredRank(userData.rank, jutsu.requiredRank)) {
warning = "You do not have the required rank to use this jutsu.";
}
if (!hasRequiredLevel(userData.level, userjutsu.jutsu.requiredLevel)) {
if (!hasRequiredLevel(userData.level, jutsu.requiredLevel)) {
warning = "You do not have the required level to use this jutsu.";
}
if (!checkJutsuRank(userjutsu.jutsu.jutsuRank, userData.rank)) {
if (!checkJutsuRank(jutsu.jutsuRank, userData.rank)) {
warning = "You do not have the required rank to use this jutsu.";
}
if (!checkJutsuVillage(userjutsu.jutsu, userData)) {
if (!checkJutsuVillage(jutsu, userData)) {
warning = "You do not have the required village to use this jutsu.";
}
if (!checkJutsuBloodline(userjutsu.jutsu, userData)) {
if (!checkJutsuBloodline(jutsu, userData)) {
warning = "You do not have the required bloodline to use this jutsu.";
}
}
Expand Down
2 changes: 1 addition & 1 deletion app/src/libs/jutsu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { JUTSU_TRANSFER_FREE_AMOUNT } from "@/drizzle/constants";
import { JUTSU_TRANSFER_FREE_NORMAL } from "@/drizzle/constants";
import { JUTSU_TRANSFER_FREE_SILVER } from "@/drizzle/constants";
import { JUTSU_TRANSFER_FREE_GOLD } from "@/drizzle/constants";
import { useForm } from "react-hook-form";
import { useForm } from "@hookform/resolvers/react-hook-form";
import { zodResolver } from "@hookform/resolvers/zod";
import { JutsuValidator } from "@/libs/combat/types";
import type { FederalStatus } from "@/drizzle/constants";
Expand Down

0 comments on commit 8aa7077

Please sign in to comment.