Skip to content

Commit

Permalink
add resurrect advancement
Browse files Browse the repository at this point in the history
  • Loading branch information
Cheaterpaul committed Dec 3, 2023
1 parent d97a511 commit 79081ad
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"parent": "vampirism:vampire/become_vampire",
"criteria": {
"main": {
"conditions": {
"type": "LEVEL",
"faction": "vampirism:vampire",
"level": 1
},
"trigger": "vampirism:faction"
},
"resurrected": {
"conditions": {
"action": "RESURRECT"
},
"trigger": "vampirism:vampire_action"
}
},
"display": {
"announce_to_chat": true,
"description": {
"translate": "advancement.vampirism.resurrect.desc"
},
"frame": "task",
"hidden": true,
"icon": {
"item": "vampirism:soul_orb_vampire"
},
"show_toast": true,
"title": {
"translate": "advancement.vampirism.resurrect"
}
},
"requirements": [
[
"resurrected"
],
[
"main"
]
],
"sends_telemetry_event": true
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ protected Instance createInstance(@NotNull JsonObject json, @NotNull ContextAwar
}

public enum Action {
SNIPED_IN_BAT, POISONOUS_BITE, PERFORM_RITUAL_INFUSION, BAT, SUCK_BLOOD, NONE, KILL_FROZEN_HUNTER
SNIPED_IN_BAT, POISONOUS_BITE, PERFORM_RITUAL_INFUSION, BAT, SUCK_BLOOD, NONE, KILL_FROZEN_HUNTER, RESURRECT
}

static class Instance extends AbstractCriterionTriggerInstance {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,12 @@ public void generate(@NotNull Advancement root, HolderLookup.@NotNull Provider h
.addCriterion("flower", VampireActionCriterionTrigger.builder(VampireActionCriterionTrigger.Action.PERFORM_RITUAL_INFUSION))
.addCriterion("main", FactionCriterionTrigger.level(VReference.VAMPIRE_FACTION, 1))
.save(consumer, REFERENCE.MODID + ":vampire/blood_cult");
Advancement resurrect = Advancement.Builder.advancement()
.display(ModItems.SOUL_ORB_VAMPIRE.get(), Component.translatable("advancement.vampirism.resurrect"), Component.translatable("advancement.vampirism.resurrect.desc"), null, FrameType.TASK, true, true, true)
.parent(become_vampire)
.addCriterion("resurrected", VampireActionCriterionTrigger.builder(VampireActionCriterionTrigger.Action.RESURRECT))
.addCriterion("main", FactionCriterionTrigger.level(VReference.VAMPIRE_FACTION, 1))
.save(consumer, REFERENCE.MODID + ":vampire/resurrect");
Advancement extra_storage = Advancement.Builder.advancement()
.display(ModBlocks.BLOOD_CONTAINER.get(), Component.translatable("advancement.vampirism.extra_storage"), Component.translatable("advancement.vampirism.extra_storage.desc"), null, FrameType.TASK, true, true, true)
.parent(first_blood)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1058,6 +1058,9 @@ public void tryResurrect() {
}
this.player.addEffect(new MobEffectInstance(ModEffects.NEONATAL.get(), duration));
this.player.awardStat(ModStats.resurrected);
if (this.player instanceof ServerPlayer serverPlayer) {
ModAdvancements.TRIGGER_VAMPIRE_ACTION.trigger(serverPlayer, VampireActionCriterionTrigger.Action.RESURRECT);
}
} else {
if (this.isRemote()) {
this.setDBNOTimer(-1);
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/assets/vampirism/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,8 @@
"advancement.vampirism.hunter_kill_mother.desc": "You've proven your mettle as a true hunter by conquering the 'Ancient Remains' and dealing a blow to vampiric power.",
"advancement.vampirism.vampire_kill_mother": "Ancient Dominion",
"advancement.vampirism.vampire_kill_mother.desc": "You've have vanquishing the local source of power, a questionable accomplishment.",
"advancement.vampirism.resurrect": "I always come back",
"advancement.vampirism.resurrect.desc": "Resurrect as a vampire",
"__comment": "effect",
"effect.vampirism.sunscreen": "Sunscreen",
"effect.vampirism.thirst": "Thirst",
Expand Down

0 comments on commit 79081ad

Please sign in to comment.