Skip to content

Commit

Permalink
Talents (#422)
Browse files Browse the repository at this point in the history
* add most talents

* add shield overload unlock trigger

* implement the effects of Augmented Casting

* fix a bug with % symbols in translations

* update compendium
  • Loading branch information
IchHabeHunger54 authored Sep 16, 2023
1 parent 8f2a1fc commit fec09e0
Show file tree
Hide file tree
Showing 60 changed files with 619 additions and 113 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.github.minecraftschurlimods.arsmagicalegacy.api.spell.ISpell;
import com.github.minecraftschurlimods.arsmagicalegacy.api.spell.ISpellComponent;
import com.github.minecraftschurlimods.arsmagicalegacy.api.spell.ISpellModifier;
import com.github.minecraftschurlimods.arsmagicalegacy.api.spell.ISpellPartStat;
import com.github.minecraftschurlimods.arsmagicalegacy.api.util.ItemFilter;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.phys.HitResult;
Expand Down Expand Up @@ -247,4 +248,22 @@ public ReagentCost(LivingEntity entity, ISpell spell, List<ItemFilter> reagents)
this.reagents = new ArrayList<>(reagents);
}
}

/**
* Event to modify the value of spell stats.
* This is called whenever a stat modifier is checked, meaning that it may be called multiple times per spell cast.
* This is called after spell modifiers have already been considered, meaning that the modified value already contains the modifier values.
*/
public static final class ModifyStats extends SpellEvent {
public final ISpellPartStat stat;
public final float base;
public float modified;

public ModifyStats(LivingEntity entity, ISpell spell, ISpellPartStat stat, float base, float modified) {
super(entity, spell);
this.stat = stat;
this.base = base;
this.modified = modified;
}
}
}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ protected void generate() {
builder("offense", 0).setStartX(226).setStartY(46).build();
builder("defense", 1).setStartX(181).setStartY(46).build();
builder("utility", 2).setStartX(136).setStartY(46).build();
builder("affinity", 3).setRenderer(OcculusAffinityTabRenderer.class).build();
builder("talent", 3).setStartX(91).setStartY(46).build();
builder("affinity", 4).setRenderer(OcculusAffinityTabRenderer.class).build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.github.minecraftschurlimods.arsmagicalegacy.common.init.AMEntities;
import com.github.minecraftschurlimods.arsmagicalegacy.common.init.AMItems;
import com.github.minecraftschurlimods.arsmagicalegacy.common.init.AMSpellParts;
import com.github.minecraftschurlimods.arsmagicalegacy.common.init.AMTalents;
import com.github.minecraftschurlimods.arsmagicalegacy.compat.patchouli.PatchouliCompat;
import com.github.minecraftschurlimods.patchouli_datagen.AbstractPageBuilder;
import com.github.minecraftschurlimods.patchouli_datagen.BookBuilder;
Expand Down Expand Up @@ -53,14 +54,16 @@ protected void addBooks(Consumer<BookBuilder<?, ?, ?>> consumer) {
.setSortnum(0)
.addEntry("getting_started", "Getting Started", api.getBookStack())
.setPriority(true)
.addSimpleTextPage("Spellcrafting looks complex from a distance, but gets very easy when doing it more often.$(br2)You start by crafting an $(l:blocks/occulus)Occulus$(), placing it down and opening it. Through the Occulus, you can unlock new skills. Skills come in three categories, more on that in a minute.")
.addImagePage(new ResourceLocation(ArsMagicaAPI.MOD_ID, "patchouli_books/arcane_compendium/en_us/images/occulus.png")).setText("The Occulus has four tabs, the first three of which are skill tree tabs.").build()
.addSimpleTextPage("Spellcrafting looks complex from a distance, but gets very easy when doing it more often.$(br2)You start by crafting an $(l:blocks/occulus)Occulus$(), placing it down and opening it. Through the Occulus, you can unlock new skills. Skills come in four categories, more on that in a minute.")
.addImagePage(new ResourceLocation(ArsMagicaAPI.MOD_ID, "patchouli_books/arcane_compendium/en_us/images/occulus.png")).setText("The Occulus has five tabs, the first four of which are skill tree tabs.").build()
.addSimpleTextPage("The first category of skills, shapes, determine how the spell is cast. For example, $(l:shapes/self)Self$() means that the spell is cast onto yourself, while $(l:shapes/projectile)Projectile$() shoots a projectile that casts the spell on whatever it hits.$(br2)Shapes have a square outline in the Occulus.", "Shapes")
.addSimpleTextPage("The second skill category, the components, represent what the spell does. For instance, $(l:components/physical_damage)Physical Damage$() acts as if the spell hit the target with a sword, while $(l:components/dig)Dig$() breaks the targeted block. As you may have guessed, some components only affect blocks, some only affect mobs, some affect both, and very few affect neither, instead doing something else entirely.$(br2)Components have an octagonal outline in the Occulus.", "Components")
.addSimpleTextPage("And lastly, modifiers. Modifiers can affect both shapes and components, but not every combination will turn out to actually have an effect (what sense would $(l:components/fire_damage)Fire Damage$() + $(l:modifiers/gravity)Gravity$() make?) The book tells you most, but not all useful combinations.$(br2)Modifiers have a rotated square outline in the Occulus.", "Modifiers")
.addSimpleTextPage("Next up, modifiers. Modifiers can affect both shapes and components, but not every combination will turn out to actually have an effect (what sense would $(l:components/fire_damage)Fire Damage$() + $(l:modifiers/gravity)Gravity$() make?) The book tells you most, but not all useful combinations.$(br2)Modifiers have a rotated square outline in the Occulus.", "Modifiers")
.addSimpleTextPage("And finally, talents. Talents are not regular spell parts, instead, they are permanent unlockables that boost the player's capability to perform magic in different ways.$(br2)Talents have an octagonal shape, like components. They can be distinguished from them by looking at the tab: All talents are in the Occulus's Talents tab, and all octagonal parts in the Talents tab are talent skills.", "Talents")
.addSimpleTextPage("A word should also go to the Affinity tab of the Occulus. This tab displays your affinity depths. It would be too complex to explain this here, so for further reading, please consult the $(l:affinities/affinities)affinity chapter$().", "Affinities")
.addSimpleTextPage("At this point, you may rightfully ask yourself: Why should I learn all this? We'll catch up to this in a moment. For now, the next thing you need is an $(l:blocks/inscription_table)Inscription Table$(). The Inscription Table is where you will assemble your spell. Since this can be complex for novices, it will be explained in detail on the following pages.")
.addImagePage(new ResourceLocation(ArsMagicaAPI.MOD_ID, "patchouli_books/arcane_compendium/en_us/images/inscription_table_1.png")).build()
.addSimpleTextPage("1) The Source Area contains all skills you currently know. The search bar can be used to quickly find the part you want.$(br)2) A slot that takes in a Book & Quill. The spell recipe will be written onto this book.$(br)3) A total of five brown squares, the so-called $(l:mechanics/shape_groups)shape group$() areas. You can drag shapes and modifiers here. For the beginning, you should only be using the first one.$(br)4) The spell grammar section. This is where components and component-related modifiers go.")
.addSimpleTextPage("1) The Source Area contains all skills you currently know.$(br)2) A slot that takes in a Book & Quill. The spell recipe will be written onto this book.$(br)3) A total of five brown squares, the so-called $(l:mechanics/shape_groups)shape group$() areas. You can drag shapes and modifiers here. For the beginning, you should only be using the first one.$(br)4) The spell grammar section. This is where components and component-related modifiers go.")
.addImagePage(new ResourceLocation(ArsMagicaAPI.MOD_ID, "patchouli_books/arcane_compendium/en_us/images/inscription_table_1.png")).setText("The search bar can be used to quickly find a spell part. The name bar can be used to name your spell, this is not required though.").build()
.addImagePage(new ResourceLocation(ArsMagicaAPI.MOD_ID, "patchouli_books/arcane_compendium/en_us/images/inscription_table_2.png")).setText("Drag the skills down to the shape groups and the spell grammar section.").build()
.addImagePage(new ResourceLocation(ArsMagicaAPI.MOD_ID, "patchouli_books/arcane_compendium/en_us/images/inscription_table_3.png")).setText("The shown spell recipe is $(l:shapes/projectile)Projectile$()-$(l:components/dig)Dig$(), which is recommended for beginners.").build()
.addSimpleTextPage("Note that not every combination is allowed in the Inscription Table. Do not worry, though, since you will notice soon enough that you're trying to do something that is not permitted.$(br2)Once you are done, simply take out the book.")
Expand Down Expand Up @@ -323,10 +326,6 @@ protected void addBooks(Consumer<BookBuilder<?, ?, ?>> consumer) {
.setSortnum(5);
TranslatedCategoryBuilder modifiers = builder.addCategory("modifiers", "Modifiers", "", ArsMagicaAPI.MOD_ID + ":textures/icon/skill/target_non_solid.png")
.setSortnum(6);
/*
TranslatedCategoryBuilder talents = builder.addCategory("talents", "Talents", "", ArsMagicaAPI.MOD_ID + ":textures/icon/skill/augmented_casting.png")
.setSortnum(7);
*/
for (ISpellPart spellPart : api.getSpellPartRegistry()) {
if (spellPart != AMSpellParts.MELT_ARMOR.get() && spellPart != AMSpellParts.NAUSEA.get() && spellPart != AMSpellParts.SCRAMBLE_SYNAPSES.get()) {
TranslatedCategoryBuilder b = switch (spellPart.getType()) {
Expand All @@ -348,6 +347,14 @@ protected void addBooks(Consumer<BookBuilder<?, ?, ?>> consumer) {
shapes.build();
components.build();
modifiers.build();
TranslatedCategoryBuilder talents = builder.addCategory("talents", "Talents", "", ArsMagicaAPI.MOD_ID + ":textures/icon/skill/mana_regen_boost_1.png")
.setSortnum(7);
for (ResourceLocation talent : AMTalents.ALL) {
TranslatedEntryBuilder entry = talents.addEntry(talent.getPath(), Util.makeDescriptionId("skill", talent) + ".name", talent.getNamespace() + ":textures/icon/skill/" + talent.getPath() + ".png")
.setAdvancement(new ResourceLocation(ArsMagicaAPI.MOD_ID, "book/" + talent.getPath()));
entry.addSimpleTextPage(entry.getLangKey(0) + ".text").build();
}
talents.build();
TranslatedCategoryBuilder affinities = builder.addCategory("affinities", "Affinities", "", affinityHelper.getEssenceForAffinity(Affinity.WATER))
.setSortnum(8);
affinities.addEntry("affinities", "Affinities", affinityHelper.getTomeForAffinity(Affinity.NONE))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.github.minecraftschurlimods.arsmagicalegacy.common.init.AMEntities;
import com.github.minecraftschurlimods.arsmagicalegacy.common.init.AMItems;
import com.github.minecraftschurlimods.arsmagicalegacy.common.init.AMSpellParts;
import com.github.minecraftschurlimods.arsmagicalegacy.common.init.AMTalents;
import com.github.minecraftschurlimods.arsmagicalegacy.common.ritual.effect.EntitySpawnRitualEffect;
import com.github.minecraftschurlimods.arsmagicalegacy.common.ritual.effect.LearnSkillRitualEffect;
import com.github.minecraftschurlimods.arsmagicalegacy.common.ritual.effect.PlaceBlockRitualEffect;
Expand Down Expand Up @@ -132,5 +133,8 @@ protected void generate() {
builder("unlock_prosperity", new LearnSkillRitualEffect(AMSpellParts.PROSPERITY.get()),
new SpellComponentCastRitualTrigger(List.of(AMSpellParts.DIG.get(), AMSpellParts.PHYSICAL_DAMAGE.get()), List.of(AMSpellParts.MINING_POWER.get(), AMSpellParts.SILK_TOUCH.get())))
.build();
builder("unlock_shield_overload", new LearnSkillRitualEffect(AMTalents.SHIELD_OVERLOAD),
new SpellComponentCastRitualTrigger(List.of(AMSpellParts.SHIELD.get(), AMSpellParts.MANA_DRAIN.get())))
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import static com.github.minecraftschurlimods.arsmagicalegacy.common.init.AMSkillPoints.GREEN;
import static com.github.minecraftschurlimods.arsmagicalegacy.common.init.AMSkillPoints.RED;
import static com.github.minecraftschurlimods.arsmagicalegacy.common.init.AMSpellParts.*;
import static com.github.minecraftschurlimods.arsmagicalegacy.common.init.AMTalents.*;

class AMSkillProvider extends SkillProvider {
private static final ResourceLocation OFFENSE = new ResourceLocation(ArsMagicaAPI.MOD_ID, "offense");
Expand Down Expand Up @@ -448,6 +449,44 @@ protected void generate() {
.addCost(RED.get())
.addParent(FLING.getId())
.build();
talent(AFFINITY_GAINS_BOOST, 120, 30)
.addCost(BLUE.get())
.addParent(MANA_REGEN_BOOST_1)
.build();
talent(AUGMENTED_CASTING, 30, 120)
.addCost(RED.get())
.addParent(SPELL_MOTION)
.build();
/*talent(EXTRA_SUMMONS, 30, 165)
.addCost(RED.get())
.addParent(AUGMENTED_CASTING)
.build();
talent(MAGE_BAND_1, 120, 75)
.addCost(GREEN.get())
.addParent(MANA_REGEN_BOOST_2)
.build();
talent(MAGE_BAND_2, 120, 120)
.addCost(RED.get())
.addParent(MAGE_BAND_1)
.build();*/
talent(MANA_REGEN_BOOST_1, 75, 30)
.addCost(BLUE.get())
.build();
talent(MANA_REGEN_BOOST_2, 75, 75)
.addCost(GREEN.get())
.addParent(MANA_REGEN_BOOST_1)
.build();
talent(MANA_REGEN_BOOST_3, 75, 120)
.addCost(RED.get())
.addParent(MANA_REGEN_BOOST_2)
.build();
talent(SHIELD_OVERLOAD, 30, 30)
.setHidden()
.build();
talent(SPELL_MOTION, 30, 75)
.addCost(GREEN.get())
.addParent(MANA_REGEN_BOOST_2)
.build();
}

private Builder offense(RegistryObject<? extends ISpellPart> part, int x, int y) {
Expand All @@ -462,7 +501,7 @@ private Builder utility(RegistryObject<? extends ISpellPart> part, int x, int y)
return builder(part.getId().getPath(), UTILITY, x, y);
}

private Builder talent(RegistryObject<? extends ISpellPart> part, int x, int y) {
return builder(part.getId().getPath(), TALENT, x, y);
private Builder talent(ResourceLocation id, int x, int y) {
return builder(id.getPath(), TALENT, x, y);
}
}
Loading

0 comments on commit fec09e0

Please sign in to comment.