Skip to content
This repository has been archived by the owner on Jan 21, 2023. It is now read-only.

Feature Request: Sorcery Point Conversion #122

Open
evilcj925 opened this issue Jun 5, 2021 · 3 comments
Open

Feature Request: Sorcery Point Conversion #122

evilcj925 opened this issue Jun 5, 2021 · 3 comments

Comments

@evilcj925
Copy link

A feature to manage a sorcerers conversion of spell slots in to sorcery points and vice versa.

@TheRarita
Copy link

There is mod for that :)
https://github.com/misthero/dnd5e-spellpoints

@evilcj925
Copy link
Author

That mod handles spell points being used over spell slots. The Sorcery Points of a sorcerer work differently. They are used along with spell slots, and allow a sorcerer to convert the points in to spell slots, or slots can be converted in to points. The points are used for metamagic. Spells still require spell slots to be cast. This is part of a sorcerers Flexible Casting class feature.
The mod you pointed out seems to override spell slots completely, and prevents them from being used.
The requested feature would, in my head, would have a way to subtract spell slots and adding to the sorcery points, the amount added depending on the level of spell slot used. There would also need to be a way to subtract from the sorcery points, and regain spell slots, a different cost of amount of points based on the level of spell slot regained. Currently I use the primary resource to track sorcery points, as there is not really a easier way to track them.
A pop up menu when the feature is used that has a selection of what you want to convert, points or slots, then depending on the choice, it reads the value of remain points and gives you a selection of what level slot you want to regain, then subtracts the points, and adds the slot back. Or if you choose to regain points, gives a list of available slots, then depending the on the level selected, adds the correct amount of sorcery points back.
This can done by all sorcerers, but the wild magic subclass and the wild magic surge feature means finding a way to have the conversion feature not trigger it.
This sounds like a project......

@TheRarita
Copy link

TheRarita commented Jun 6, 2021

Ok, I think I know what you want. Not the most elegant solution since I am not really good at this and just mangled a bunch of code I found plus edited it together but here are 2 macros that will let you convert spell points to spell slots and vice versa.

In both, you have to edit which spell slot you want to use and how many spell points you want to use as well as choose were should the spells points be taken from (resources or feature charges). So basically you would have 10 macros, 5 for spellpoints->spellslot for each level of spell and 5 for spellslots->spellpoints for each level of the spell.

Be advised, the change to spell slots won't show until you re-open the character sheet for some reason, and also token has to be selected, character sheet does not have to be open.

I did this mostly for myself since I did not realize I need this too so... :D

let recover_spell_slot = async function() {
	// CHOOSE 1 OF 2 FOLLOWING
	// primary resource by default could also by any other resource (secondary, tertiary etc)
	const sp_resource = _token.actor.data.data.resources.primary.value;
	
	// or short loop to search for a feature you use for tracking, like "Font of Magic", see bellow
	let feature_number; 
	let sp_tracking_feature = () => {
		for (let i = 0; i < _token.actor.data.items.contents.length; i++) {
			if (_token.actor.data.items.contents[i].data.name === "Font of Magic") {
				sp_tracking_feature = _token.actor.data.items.contents[i].data._id;
				feature_number = i;
			}
		}
	}
	sp_tracking_feature();
	
	// number of spell points to use for conversion
	const sp_to_spend = 2;
	// number of spell slots to recover
	const spell_slots_to_recover = 1;
	// level of spell slots to recover (spell2, spell3, etc)
	const spell_level_to_recover = "spell1";
	// currect number of spell slots
	const spell_slots_current = _token.actor.data.data.spells[spell_level_to_recover].value;
	
	
	// CHOOSE 1 OF 2 FOLLOWING based on what you chose first
	// primary resource by default could also by any other resource (secondary, tertiary etc)
	_token.actor.data.data.resources.primary.value = sp_resource - sp_to_spend;
	
	// feature tracking like "Font of Magic"
	await _token.actor.updateEmbeddedEntity("Item", {"_id": sp_tracking_feature, "data.uses.value" : _token.actor.data.items.contents[feature_number].data.data.uses.value - sp_to_spend});
	
	// adds spell slot to spell level
	_token.actor.data.data.spells[spell_level_to_recover].value = spell_slots_current + spell_slots_to_recover;
}

recover_spell_slot();




let recover_spell_point = async function() {
	// CHOOSE 1 OF 2 FOLLOWING
	// primary resource by default could also by any other resource (secondary, tertiary etc)
	const sp_resource = _token.actor.data.data.resources.primary.value;
	
	// or short loop to search for a feature you use for tracking, like "Font of Magic", see bellow
	let feature_number; 
	let sp_tracking_feature = () => {
		for (let i = 0; i < _token.actor.data.items.contents.length; i++) {
			if (_token.actor.data.items.contents[i].data.name === "Font of Magic") {
				sp_tracking_feature = _token.actor.data.items.contents[i].data._id;
				feature_number = i;
			}
		}
	}
	sp_tracking_feature();
	
	// number of spell points to use for conversion
	const sp_to_spend = 2;
	// number of spell slots to use
	const spell_slots_to_recover = 1;
	// level of spell slots to use for conversion (spell2, spell3, etc)
	const spell_level_to_recover = "spell1";
	// currect number of spell slots
	const spell_slots_current = _token.actor.data.data.spells[spell_level_to_recover].value;
	
	
	// CHOOSE 1 OF 2 FOLLOWING based on what you chose first
	// primary resource by default could also by any other resource (secondary, tertiary etc)
	_token.actor.data.data.resources.primary.value = sp_resource + sp_to_spend;
	
	// feature tracking like "Font of Magic"
	await _token.actor.updateEmbeddedEntity("Item", {"_id": sp_tracking_feature, "data.uses.value" : _token.actor.data.items.contents[feature_number].data.data.uses.value + sp_to_spend});
	
	// adds spell slot to spell level
	_token.actor.data.data.spells[spell_level_to_recover].value = spell_slots_current - spell_slots_to_recover;
}

recover_spell_point();

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants