Skip to content

Commit

Permalink
Merge pull request dmdorman#1601 from aeauseth/main
Browse files Browse the repository at this point in the history
attacking with prototype. NOTELEPORT. OIHID actor description.
  • Loading branch information
aeauseth authored Dec 8, 2024
2 parents 8e14e70 + e28a659 commit 1a729c7
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 12 deletions.
4 changes: 0 additions & 4 deletions module/actor/actor-token.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,6 @@ export class HeroSystem6eTokenDocument extends TokenDocument {
item.isActive,
);

if (this.name === "Onyx") {
console.log(this);
}

if (SIGHTGROUP && !this.actor?.statuses.has("blind")) {
const basicMode = this.detectionModes.find((m) => m.id === "basicSight");
basicMode.range = maxRange;
Expand Down
10 changes: 10 additions & 0 deletions module/config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7113,6 +7113,16 @@ function addPower(powerDescription6e, powerOverrideFor5e) {
{},
);

//NOTELEPORT
addPower(
{
key: "NOTELEPORT",
costPerLevel: 0.25, //costPerLevelFixedValue(0),
xml: ` <MODIFIER XMLID="NOTELEPORT" ID="1733613873292" BASECOST="0.0" LEVELS="1" ALIAS="Cannot Be Escaped With Teleportation" POSITION="-1" MULTIPLIER="1.0" GRAPHIC="Burst" COLOR="255 255 255" SFX="Default" SHOW_ACTIVE_COST="Yes" INCLUDE_NOTES_IN_PRINTOUT="Yes" NAME="" COMMENTS="" PRIVATE="No" FORCEALLOW="No"></MODIFIER>`,
},
{},
);

addPower(
{
key: "OIHID",
Expand Down
2 changes: 1 addition & 1 deletion module/item/item-attack.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -985,7 +985,7 @@ export async function AttackToHit(item, options) {
.find((o) => o.key === parseInt(options.mindScanMinds))
?.label.match(/[\d,]+/)?.[0],
action,
inActiveCombat: token.inCombat,
inActiveCombat: token?.inCombat,
};
options.rolledResult = targetData;
action.system = {}; // clear out any system information that would interfere with parsing
Expand Down
8 changes: 6 additions & 2 deletions module/item/item.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,9 @@ export class HeroSystem6eItem extends Item {
// Power must be turned on
if (this.system.active === false) return false;

// Only In ALternate Identity
if (this.findModsByXmlid("OIHID") && this.actor.system.heroicIdentity === false) return false;

// TODO: Costs endurance (even if bought to 0 END) is perceivable when active unless it has invisible power effect bought for it.

// FOCUS
Expand Down Expand Up @@ -4108,7 +4111,7 @@ export class HeroSystem6eItem extends Item {

// Multiple levels?
if ((parseInt(modifier.LEVELS) || 0) > 1) {
if (["HARDENED", "PENETRATING", "ARMORPIERCING"].includes(modifier.XMLID)) {
if (["HARDENED", "PENETRATING", "ARMORPIERCING", "NOTELEPORT"].includes(modifier.XMLID)) {
result += "x" + parseInt(modifier.LEVELS) + "; ";
}
}
Expand Down Expand Up @@ -5293,10 +5296,11 @@ export class HeroSystem6eItem extends Item {

/// Get Levels with AID/DRAIN Active Effects
get adjustedLevels() {
// TODO: Custom adjustedLevels in config.mjs for things that are all or nothing?
let _adjustedLevels = parseInt(this.system.LEVELS || 0);

for (const ae of this.actor.temporaryEffects.filter(
(effect) => effect.flags.XMLID === "DRAIN" && effect.flags.key === "POWERDEFENSE",
(effect) => effect.flags.XMLID === "DRAIN" && effect.flags.key === this.system.XMLID,
)) {
console.log(ae);
_adjustedLevels += parseInt(ae.changes?.[0].value || 0);
Expand Down
8 changes: 4 additions & 4 deletions module/utility/adjustment.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,8 @@ function _createNewAdjustmentEffect(
const itemTokenName =
canvas.tokens.get(action?.current?.attackerTokenId)?.name ||
item.actor?.getActiveTokens().find((t) => canvas.tokens.controlled.find((c) => c.id === t.id))?.name ||
item.actor?.getActiveTokens()?.[0].name ||
targetActor.name ||
item.actor?.getActiveTokens()?.[0]?.name ||
item.actor?.name ||
"undefined";

const activeEffect = {
Expand Down Expand Up @@ -568,8 +568,8 @@ export async function performAdjustment(
const itemTokenName =
canvas.tokens.get(action?.current?.attackerTokenId)?.name ||
item.actor?.getActiveTokens().find((t) => canvas.tokens.controlled.find((c) => c.id === t.id))?.name ||
item.actor?.getActiveTokens()?.[0].name ||
targetActor.name ||
item.actor?.getActiveTokens()?.[0]?.name ||
item.actor?.name ||
"undefined";

// Update the effect max value(s)
Expand Down
6 changes: 5 additions & 1 deletion module/utility/attack.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,11 @@ export class Attack {
}

static getAttackerToken(item) {
const attackerToken = item.actor.getActiveTokens()[0] || canvas.tokens.controlled[0];
// Careful: you may have a controlled token, but use an attack from actor on sidebar
//const attackerToken = item.actor?.getActiveTokens()[0] || canvas.tokens.controlled.find;
const attackerToken =
item.actor?.getActiveTokens().find((t) => canvas.tokens.controlled.find((c) => c.id === t.id)) ||
item.actor.prototypeToken;
if (!attackerToken) {
console.error("There is no actor token!");
}
Expand Down

0 comments on commit 1a729c7

Please sign in to comment.