Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
7 changes: 5 additions & 2 deletions scripts/skills/actives/rf_en_garde_toggle_skill.nut
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,12 @@ this.rf_en_garde_toggle_skill <- ::inherit("scripts/skills/skill", {
}
}

function onAffordablePreview( _skill, _movementTile )
function onAfterUpdate( _properties )
{
this.modifyPreviewField(this, "FatigueCost", 15, false);
// During preview set the fatigue cost so that the player knows if their previewed action
// will still allow en garde to trigger afterward
if (this.getContainer().getActor().isPreviewing())
this.m.FatigueCost = this.m.FatigueRequired;
}

function onUse( _user, _targetTile )
Expand Down
25 changes: 4 additions & 21 deletions scripts/skills/perks/perk_rf_combo.nut
Original file line number Diff line number Diff line change
Expand Up @@ -50,28 +50,11 @@ this.perk_rf_combo <- ::inherit("scripts/skills/skill", {

function onAfterUpdate( _properties )
{
if (this.m.UsedSkillID == "")
return;

foreach (skill in this.getContainer().getAllSkillsOfType(::Const.SkillType.Active))
{
if (skill.getID() != this.m.UsedSkillID && skill.m.ActionPointCost > 3)
{
skill.m.ActionPointCost -= 1;
}
}
}

function onAfterUpdatePreview( _properties, _previewedSkill, _previewedMovement )
{
local usedSkillID = "";
if (_previewedMovement != null)
{
usedSkillID = this.m.UsedSkillID;
}
else if (_previewedSkill.getActionPointCost() != 0)
local actor = this.getContainer().getActor();
local usedSkillID = this.m.UsedSkillID;
if (actor.isPreviewing() && actor.getPreviewSkill() != null)
{
usedSkillID = _previewedSkill.getID();
usedSkillID = actor.getPreviewSkill().getID();
}

if (usedSkillID != "")
Expand Down
20 changes: 6 additions & 14 deletions scripts/skills/perks/perk_rf_fresh_and_furious.nut
Original file line number Diff line number Diff line change
Expand Up @@ -67,24 +67,16 @@ this.perk_rf_fresh_and_furious <- ::inherit("scripts/skills/skill", {

function onAfterUpdate( _properties )
{
if (!this.m.IsSpent && !this.m.RequiresRecover)
{
foreach (skill in this.getContainer().getAllSkillsOfType(::Const.SkillType.Active))
{
// ::Math.round to round up the subtraction because we want to emulate the behavior of _properties.IsSkillUseHalfCost
// whereby it rounds down the cost (due to integer division) after halving it.
skill.m.ActionPointCost -= ::Math.max(0, ::Math.min(skill.m.ActionPointCost - 1, ::Math.round(skill.m.ActionPointCost / 2.0)));
}
}
}
if (this.m.IsSpent || this.m.RequiresRecover)
return;

function onAffordablePreview( _skill, _movementTile )
{
if (_skill != null && _skill.getActionPointCost() != 0 && _skill.getFatigueCost() != 0)
local actor = this.getContainer().getActor();
if (!actor.isPreviewing() || actor.getPreviewMovement() != null || (actor.getPreviewSkill().getActionPointCost() == 0 && actor.getPreviewSkill().getFatigueCost() == 0))
Comment thread
Darxo marked this conversation as resolved.
Comment thread
Darxo marked this conversation as resolved.
{
foreach (skill in this.getContainer().getAllSkillsOfType(::Const.SkillType.Active))
{
this.modifyPreviewField(skill, "ActionPointCost", 0, false);
if (skill.m.ActionPointCost > 1)
skill.m.ActionPointCost /= 2;
}
}
}
Expand Down
17 changes: 6 additions & 11 deletions scripts/skills/perks/perk_rf_vanquisher.nut
Original file line number Diff line number Diff line change
Expand Up @@ -66,20 +66,15 @@ this.perk_rf_vanquisher <- ::inherit("scripts/skills/skill", {

function onAfterUpdate( _properties )
{
if (this.m.IsInEffect)
local actor = this.getContainer().getActor();
local isValid = this.m.IsInEffect;
if (actor.isPreviewing())
{
foreach (skill in this.getContainer().m.Skills)
{
if (!skill.isGarbage() && skill.m.ActionPointCost > 1)
skill.m.ActionPointCost /= 2;
}
// Gain Ground can only be used on a valid tile
isValid = (actor.getPreviewMovement() != null && !this.isTileValid(actor.getPreviewMovement().End)) || (actor.getPreviewSkill() != null && actor.getPreviewSkill().getID() != "actives.rf_gain_ground");
Comment thread
Darxo marked this conversation as resolved.
}
}

function onAfterUpdatePreview( _properties, _previewedSkill, _previewedMovement )
{
// Gain Ground can only be used on a valid tile
if ((_previewedSkill != null && _previewedSkill.getID() == "actives.rf_gain_ground") || (_previewedMovement != null && this.isTileValid(_previewedMovement.End)))
if (isValid)
{
foreach (skill in this.getContainer().m.Skills)
{
Expand Down
32 changes: 5 additions & 27 deletions scripts/skills/perks/perk_rf_vigorous_assault.nut
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,18 @@ this.perk_rf_vigorous_assault <- ::inherit("scripts/skills/skill", {

function onAfterUpdate( _properties )
{
local actor = this.getContainer().getActor();
if (actor.isPreviewing() && actor.getPreviewSkill() != null) // The effect of this skill expires upon using any skill, so we reflect that in the preview
return;
Comment thread
LordMidas marked this conversation as resolved.

this.resetBonus();

if (!this.isEnabled() || !::Tactical.TurnSequenceBar.isActiveEntity(this.getContainer().getActor()))
{
return;
}

local actor = this.getContainer().getActor();
local distanceMoved = this.m.StartingTile.getDistanceTo(actor.getTile());
local distanceMoved = this.m.StartingTile.getDistanceTo(actor.isPreviewing() ? actor.getPreviewMovement().End : actor.getTile());
local aoo = this.getContainer().getAttackOfOpportunity();

local mult = distanceMoved / this.m.BonusEveryXTiles;
Expand Down Expand Up @@ -169,31 +172,6 @@ this.perk_rf_vigorous_assault <- ::inherit("scripts/skills/skill", {
}
}

function onAffordablePreview( _skill, _movementTile )
{
if (!this.isEnabled()) return;

if (_skill != null)
{
foreach (skill in this.getContainer().getSkillsByFunction(@(skill) skill.isAttack()))
{
this.modifyPreviewField(skill, "ActionPointCost", 0, false);
this.modifyPreviewField(skill, "FatigueCostMult", 1, true);
}
}

if (_movementTile != null)
{
local bonus = this.m.StartingTile.getDistanceTo(_movementTile) / this.m.BonusEveryXTiles;

foreach (skill in this.getContainer().getSkillsByFunction(@(skill) skill.isAttack()))
{
this.modifyPreviewField(skill, "ActionPointCost", -1 * ::Math.max(0, ::Math.min(skill.m.ActionPointCost - 1, bonus)), false);
this.modifyPreviewField(skill, "FatigueCostMult", 1 - this.m.FatCostReduction * bonus * 0.01, true);
}
}
}

function onWaitTurn()
{
this.m.StartingTile = null;
Expand Down