Modified by MakeScope function to support a function that returns a string such as (4,2)
This allows the creation of skills that would normally be 3,2, but the character has a state that increases this range by 1.
This doesn't work with base code, as a function that returns a string is not evaluated in the "range" version, as e.getSquareRange() does not contain a comma, so it evaluates it in the single range version, and crashes
With this, I just make new TBSEntity functions, and have it return the results
Currently this code is hard-coded in my LeTBS.js file,
This only replaces the if statement for
if (data.match(/(circle|line|square|cross)\((.+)\)/i)) {
up to its closing bracket,
I recomment cloning the function and commenting out the original when you make changes, so you can easily revert.
Spoiler: BattleManagerTBS.makescope
JavaScript:
if (data.match(/(circle|line|square|cross)\((.+)\)/i)) {
console.log(data);
if (RegExp.$2.includes(",")) {
str = RegExp.$2.split(",");
size = Math.floor(Number(eval(str[0])));
min = Math.floor(Number(eval(str[1])));
} else if(RegExp.$2.includes("()"))
{
//This checks if a function is used instead of the normal circle(x)/circle(x,y) format to return a number or x,y
//This will only be used if it does not use function(),function() as that will get picked up by the first statement.
//Afterwards, it essentially clones the original function with checking if comma delimited, or not.
R2 = eval(RegExp.$2);
if (R2.includes(",")) {
str = R2.split(",");
size = Math.floor(Number(eval(str[0])));
min = Math.floor(Number(eval(str[1])));
}
else {
size = Math.floor(Number(eval(RegExp.$2)));
}
}
else {
size = Math.floor(Number(eval(RegExp.$2)));
}
}
Additionally I added some code to TBSEntity.prototype.getObjectSequenceData
Which should in theory allow you to write things like
sequence: e.skillNameSequence()
in which skillNameSequence() is a function under TBSEntity.prototype
that returns a string that matches a sequence name.
In theory this will allow me to write functions for skills that change the skill based on variables, and in theory, allow the Evolution of skills
One idea I got is actually from Xenoblade Chronicles, from a gem called "double attack" that gives a 50% chance of double attack when auto-attacking.
I can now add this onto all my basic "attack" skills
and if the user is afflcited with any form of "double attack" (i plan on 5 levels each adding 10% chance)
then it uses random numbers to determine if the user "double attacked"
and returns my sequences of
atk2 if they can, or atk if they can't
Since I do have some weapons that don't use the atk sequence (i have bows and staves) some of them use the default "skill" sequence, so for these, I cloned the skill sequence, and call it skill2 which effectively just adds the effect damage twice.
I will let you all know how the testing goes.
I did want to add a Vorpal Sword or so to speak, that gives a chance to attack up to 5 times, but without my extra code, it didn't really seem possible. now I can just set
sequence: e.vorpalSword()
and it should return either atk, atk2, atk3, atk4 or atk5
Basically its description will say something like
"Mystic Blade that has the ability to attack multiple times (up to 5)"
and will have a 25% chance of triggering each level.
This is also great for creating skills that should attack a random number of times.
Once again,
I will keep everyone posted on whether or not my code actually works how I want it.
All the stuff for conditional scopes worked in all my testing however.