Skip to content

Commit

Permalink
feat: Add INACTIVE condition for enchantments (#5962)
Browse files Browse the repository at this point in the history
* Add INACTIVE condition

Maybe it'll be useful someday

* Update docs
  • Loading branch information
RobbieNeko authored Jan 24, 2025
1 parent a5aa18c commit 8323bff
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@ Values:
- `DAWN` - When it is dawn
- `ACTIVE` - whenever the item, mutation, bionic, or whatever the enchantment is attached to is
active.
- `INACTIVE` - the opposite of `ACTIVE`

### emitter

Expand Down
5 changes: 5 additions & 0 deletions src/magic_enchantment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ namespace io
case enchantment::condition::DUSK: return "DUSK";
case enchantment::condition::DAWN: return "DAWN";
case enchantment::condition::ACTIVE: return "ACTIVE";
case enchantment::condition::INACTIVE: return "INACTIVE";
case enchantment::condition::NUM_CONDITION: break;
}
debugmsg( "Invalid enchantment::condition" );
Expand Down Expand Up @@ -190,6 +191,10 @@ bool enchantment::is_active( const Character &guy, const bool active ) const
return active;
}

if( active_conditions.second == condition::INACTIVE ) {
return !active;
}

if( active_conditions.second == condition::ALWAYS ) {
return true;
}
Expand Down
1 change: 1 addition & 0 deletions src/magic_enchantment.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ class enchantment
DUSK,
DAWN,
ACTIVE, // the item, mutation, etc. is active
INACTIVE,
NUM_CONDITION
};

Expand Down

0 comments on commit 8323bff

Please sign in to comment.