Skip to content

Commit

Permalink
Merge pull request #562 from Hypexion/no-half-turn-behaviour
Browse files Browse the repository at this point in the history
Only Process On Full Turns script behavior
  • Loading branch information
mrimer committed Dec 28, 2023
2 parents 3e13a7c + 3bad8a3 commit 6ffdcc6
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 2 deletions.
1 change: 1 addition & 0 deletions DROD/CharacterDialogWidget.cpp
Expand Up @@ -4684,6 +4684,7 @@ void CCharacterDialogWidget::PopulateBehaviorListBox()
this->pBehaviorListBox->AddItem(ScriptFlag::Behavior::AvoidPuffs, g_pTheDB->GetMessageText(MID_AvoidPuffs));
this->pBehaviorListBox->AddItem(ScriptFlag::Behavior::RestrictedMovement, g_pTheDB->GetMessageText(MID_RestrictedMovement));
this->pBehaviorListBox->AddItem(ScriptFlag::Behavior::InstantMovement, g_pTheDB->GetMessageText(MID_InstantMovement));
this->pBehaviorListBox->AddItem(ScriptFlag::Behavior::OnlyProcessOnFullTurn, g_pTheDB->GetMessageText(MID_OnlyProcessOnFullTurn));
this->pBehaviorListBox->AddItem(ScriptFlag::Behavior::MonsterAttackable, g_pTheDB->GetMessageText(MID_CanBeMonsterAttacked));
this->pBehaviorListBox->AddItem(ScriptFlag::Behavior::MonsterTarget, g_pTheDB->GetMessageText(MID_MonsterTarget));
this->pBehaviorListBox->AddItem(ScriptFlag::Behavior::MonsterTargetWhenPlayerIsTarget, g_pTheDB->GetMessageText(MID_MonsterTargetWhenPlayerIsTarget));
Expand Down
5 changes: 5 additions & 0 deletions DRODLib/Character.cpp
Expand Up @@ -1351,6 +1351,11 @@ void CCharacter::Process(
return;

CCurrentGame *pGame = const_cast<CCurrentGame*>(this->pCurrentGame);

//Don't move on half-turn if that has been forbidden
if (HasBehavior(ScriptFlag::OnlyProcessOnFullTurn) && pGame->bHalfTurn)
return;

CDbRoom& room = *(pGame->pRoom);
CSwordsman& player = pGame->swordsman;

Expand Down
3 changes: 2 additions & 1 deletion DRODLib/CharacterCommand.h
Expand Up @@ -167,7 +167,8 @@ namespace ScriptFlag
InstantMovement = 27,
UseTunnels = 28,
AvoidFiretraps = 29,
AvoidPuffs = 30
AvoidPuffs = 30,
OnlyProcessOnFullTurn = 31,
};

enum DisplayFilter
Expand Down
1 change: 1 addition & 0 deletions DRODLib/DbBase.cpp
Expand Up @@ -954,6 +954,7 @@ const WCHAR* CDbBase::GetMessageText(
case MID_CustomSpeechColor: strText = "Speech Color (rgb)"; break;
case MID_CountEntityType: strText = "Count entity type"; break;
case MID_CountItem: strText = "Count item"; break;
case MID_OnlyProcessOnFullTurn: strText = "Only Process On Full Turns"; break;
// case MID_DRODUpgradingDataFiles: strText = "DROD is upgrading your data files." NEWLINE "This could take a moment. Please be patient..."; break;
// case MID_No: strText = "&No"; break;
default: break;
Expand Down
3 changes: 2 additions & 1 deletion Data/Help/1/script.html
Expand Up @@ -566,7 +566,8 @@ <h3><u>Character Script Commands</u></h3>
<li><a name="beh-avoid-puff"><b>Avoid Puffs</b></a>: The NPC will treat Puffs like other monsters, and consider them movement obstacles. The NPC can still be pushed into a Puff.</li>
<li><a name="beh-restricted-movement"><b>Restricted Movement</b></a>: The NPC can only move onto tiles it's movement type would normally allow movement onto. See <a href="#set-movement">Set movement type</a> for details.</li>
<li><a name="beh-instant-movement"><b>Instant Movement</b></a>: Script execution for the turn will not halt after a <a href="#facedirection">Face direction</a> or <a href="#face-towards-like-guard">Face towards like guard command</a>, or after a <a href="#move">Move</a> or <a href="#moveto">Move to</a> command in Single step mode. Move and Move to commands that are not single step will still halt execution.</li>
<li><a name="beh-monster-attackable"><b>Can Be Attacked By Monsters</b></a>: Hostile monsters can move onto and kill the NPC. Monster attacks ignore the <a href="#impinvulnerable">Invulnerable</a> imperative. Additionally, this does not affect whether an Adder can eat the NPC.</li>
<li><a name="beh-full-turn-only"><b>Only Process On Full Turns</b></a>: The script will not run during "half-turns" when the player is under the effect of a speed potion.</li>
<li><a name="beh-monster-attackable"><b>Can Be Attacked By Monsters</b></a>: Hostile monsters can move onto and kill the NPC. Monster attacks ignore the <a href="#impinvulnerable">Invulnerable</a> imperative. Additionally, this does not affect whether an Adder can eat the NPC.</li>
<li><a name="beh-monster-target"><b>Monster Target</b></a>: Monsters other than Puffs will treat the NPC as a target. This does not affect the NPC's vulnerability to monsters.</li>
<li><a name="beh-monster-target-if-player"><b>Monster Target When Player Is Target</b></a>: Monsters other than Puffs will treat the NPC as a target as long as the player is a monster target. Otherwise, monsters will ignore this character. This does not affect the NPC's vulnerability to monsters.</li>
<li><a name="beh-ally-target"><b>Ally Target</b></a>: Stalwarts and Soldiers will treat the NPC as a target. However, they will avoid stabbing the NPC if it is <a href="#imp-friendly">Friendly</a>.</li>
Expand Down
1 change: 1 addition & 0 deletions Texts/MIDs.h
Expand Up @@ -1815,6 +1815,7 @@ enum MID_CONSTANT {
MID_UseTunnels = 2057,
MID_AvoidFiretraps = 2068,
MID_AvoidPuffs = 2069,
MID_OnlyProcessOnFullTurn = 2074,
MID_PreviousIf = 1940,
MID_NextElseOrElseIfSkip = 1941,
MID_PushTile = 1945,
Expand Down
4 changes: 4 additions & 0 deletions Texts/Speech.uni
Expand Up @@ -3174,6 +3174,10 @@ Avoid Firetraps
[eng]
Avoid Puffs

[MID_OnlyProcessOnFullTurn]
[eng]
Only Process On Full Turns

[MID_PreviousIf]
[eng]
<Previous If>
Expand Down

0 comments on commit 6ffdcc6

Please sign in to comment.