Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).

## `0.11.4` - ???

### Added

- Added the `cannot_modify_cost` tag for patterns that should ignore the `media_consumption` attribute when calculating cost, by Robotgiggle in [987](https://github.com/FallingColors/HexMod/pull/987)

### Changed

- Changed the `media_consumption` attribute to only apply to player-based casting, by Robotgiggle in [987](https://github.com/FallingColors/HexMod/pull/987)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
## `0.11.4` - ???
### Added
- Added the `cannot_modify_cost` tag for patterns that should ignore the `media_consumption` attribute when calculating cost, by Robotgiggle in [987](https://github.com/FallingColors/HexMod/pull/987)
### Changed
- Changed the `media_consumption` attribute to only apply to player-based casting, by Robotgiggle in [987](https://github.com/FallingColors/HexMod/pull/987)
## [UNRELEASED]
### Added
- Added the `cannot_modify_cost` tag for patterns that should ignore the `media_consumption` attribute when calculating cost, by Robotgiggle in [987](https://github.com/FallingColors/HexMod/pull/987).
### Changed
- Changed the `media_consumption` attribute to only apply to player-based casting, by Robotgiggle in [987](https://github.com/FallingColors/HexMod/pull/987).


## `0.11.3` - 2025-11-22

### Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import at.petrak.hexcasting.api.casting.ParticleSpray;
import at.petrak.hexcasting.api.casting.PatternShapeMatch;
import at.petrak.hexcasting.api.casting.eval.env.PlayerBasedCastEnv;
import at.petrak.hexcasting.api.casting.eval.vm.CastingImage;
import at.petrak.hexcasting.api.casting.mishaps.Mishap;
import at.petrak.hexcasting.api.casting.mishaps.MishapBadLocation;
Expand Down Expand Up @@ -241,14 +242,18 @@ public boolean isEnlightened() {
return false;
}

public boolean costModifierAllowed = true;

/**
* Attempt to extract the given amount of media. Returns the amount of media left in the cost.
* <p>
* If there was enough media found, it will return less or equal to zero; if there wasn't, it will be
* positive.
*/
public long extractMedia(long cost, boolean simulate) {
if (this.getCastingEntity() != null){
if (this instanceof PlayerBasedCastEnv
&& this.getCastingEntity() != null
&& costModifierAllowed) {
cost = (long) (cost * this.getCastingEntity().getAttributeValue(HexAttributes.MEDIA_CONSUMPTION_MODIFIER));
}
for (var extractMediaComponent : preMediaExtract)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,16 @@ public boolean toleratesOther(Iota that) {
// this gets caught down below
throw new MishapUnenlightened();
}

if (isOfTag(IXplatAbstractions.INSTANCE.getActionRegistry(), key, HexTags.Actions.CANNOT_MODIFY_COST)) {
vm.getEnv().costModifierAllowed = false;
} else {
vm.getEnv().costModifierAllowed = true;
}
} else if (lookup instanceof PatternShapeMatch.Special special) {
castedName = special.handler::getName;
action = special.handler.act();
vm.getEnv().costModifierAllowed = true;
} else if (lookup instanceof PatternShapeMatch.Nothing) {
throw new MishapInvalidPattern(this.getPattern());
} else throw new IllegalStateException();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ public static final class Actions {
*/
public static final TagKey<ActionRegistryEntry> CAN_START_ENLIGHTEN = create("can_start_enlighten");

/**
* Actions that should not be affected by the media_consumption attribute
*/
public static final TagKey<ActionRegistryEntry> CANNOT_MODIFY_COST = create("cannot_modify_cost");

public static TagKey<ActionRegistryEntry> create(String name) {
return TagKey.create(IXplatAbstractions.INSTANCE.getActionRegistry().key(), modLoc(name));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ protected void addTags(HolderLookup.Provider provider) {
tag(ersatzActionTag(HexTags.Actions.PER_WORLD_PATTERN)).add(key);
}
// deciding that akashic write can be just a normal spell (as a treat)

for (var actionID : new String[]{
"hexal:wisp/summon/projectile", "hexal:wisp/summon/ticking", "hexical:conjure_gummy", "hexical:charm",
"hexical:recharge_lamp", "lapisworks:deposit", "lapisworks:imbue_lap", "yaha:time_bomb"
}) {
var loc = ResourceLocation.tryParse(actionID);
tag(ersatzActionTag(HexTags.Actions.CANNOT_MODIFY_COST)).addOptional(loc);
}
}

private static TagKey<ActionRegistryEntry> ersatzActionTag(TagKey<ActionRegistryEntry> real) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"replace": false,
"values": [
{
"id": "hexal:wisp/summon/projectile",
"required": false
},
{
"id": "hexal:wisp/summon/ticking",
"required": false
},
{
"id": "hexical:conjure_gummy",
"required": false
},
{
"id": "hexical:charm",
"required": false
},
{
"id": "hexical:recharge_lamp",
"required": false
},
{
"id": "lapisworks:deposit",
"required": false
},
{
"id": "lapisworks:imbue_lap",
"required": false
},
{
"id": "yaha:time_bomb",
"required": false
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"values": [
{
"id": "hexal:wisp/summon/projectile",
"required": false
},
{
"id": "hexal:wisp/summon/ticking",
"required": false
},
{
"id": "hexical:conjure_gummy",
"required": false
},
{
"id": "hexical:charm",
"required": false
},
{
"id": "hexical:recharge_lamp",
"required": false
},
{
"id": "lapisworks:deposit",
"required": false
},
{
"id": "lapisworks:imbue_lap",
"required": false
},
{
"id": "yaha:time_bomb",
"required": false
}
]
}
Loading