Skip to content

Commit

Permalink
Merge pull request #126 from DerekM07/feat/DrugPump
Browse files Browse the repository at this point in the history
Secret Item
  • Loading branch information
Roms1383 authored May 13, 2024
2 parents 6597b1d + 16613c5 commit 8632c3b
Show file tree
Hide file tree
Showing 7 changed files with 211 additions and 0 deletions.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
localization:
onscreens:
en-us: addicted\localization\en-us.json
Binary file not shown.
Binary file not shown.
1 change: 1 addition & 0 deletions recipes/archive/justfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ tree := join('archive', 'pc', 'mod')
just pack 'Addicted.VFX'
just pack 'Addicted.Biomon'
just pack 'Addicted.Translations'
just pack 'Addicted.DrugPump'
just copy '{{ join(source, "*.archive") }}' '{{ join(TO, tree) }}';
just copy '{{ join(source, "*.xl") }}' '{{ join(TO, tree) }}';

Expand Down
66 changes: 66 additions & 0 deletions scripts/Addicted/DrugPump.reds
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
module DrugPump

public class DrugPumpConsumptionEffector extends ApplyStatusEffectEffector {
public let m_effectorChanceMods: array<wref<StatModifier_Record>>;
protected func Initialize(record: TweakDBID, game: GameInstance, parentRecord: TweakDBID) -> Void {
let player: ref<PlayerPuppet> = GetPlayer(game);
this.m_record = TweakDBInterface.GetApplyStatusEffectEffectorRecord(record).StatusEffect().GetID();
this.m_applicationTarget = TweakDBInterface.GetCName(record + t".applicationTarget", player.GetName());
this.m_removeWithEffector = TweakDBInterface.GetBool(record + t".removeWithEffector", false);
this.m_inverted = TweakDBInterface.GetBool(record + t".inverted", false);
this.m_count = TweakDBInterface.GetFloat(record + t".count", 1.00);
this.m_instigator = TweakDBInterface.GetString(record + t".instigator", "");
this.m_useCountWhenRemoving = TweakDBInterface.GetBool(record + t".useCountWhenRemoving", false);
TweakDBInterface.GetApplyStatusEffectByChanceEffectorRecord(record).EffectorChance(this.m_effectorChanceMods);
}
protected func ActionOn(owner: ref<GameObject>) -> Void {
let game: GameInstance = owner.GetGame();
let player: ref<PlayerPuppet> = GetPlayer(game);
let playerID: EntityID = player.GetEntityID();
if GameInstance.GetStatusEffectSystem(game).HasStatusEffect(playerID, t"BaseStatusEffect.BlackLaceV1") ||
GameInstance.GetStatusEffectSystem(game).HasStatusEffect(playerID, t"BaseStatusEffect.BlackLaceV0") ||
!this.GetApplicationTarget(player, this.m_applicationTarget, playerID) {
// LogChannel(n"DEBUG", "HasStatusEffect or no applicationTarget, Returning");
return;
};
if this.UseAndConsumeItem(game, player, playerID, this.GetPlayerDrugByTDBID(game, t"Items.BlackLaceV1"), t"BaseStatusEffect.BlackLaceV1") {
return;
};
if this.UseAndConsumeItem(game, player, playerID, this.GetPlayerDrugByTDBID(game, t"Items.BlackLaceV0"), t"BaseStatusEffect.BlackLaceV0") {
return;
};
}
protected func UseAndConsumeItem(game: GameInstance, player: ref<PlayerPuppet>, playerID: EntityID, itemID: ItemID, tdbid: TweakDBID) -> Bool {
if !Equals(itemID, ItemID.None()) && Equals(TweakDBInterface.GetItemRecord(ItemID.GetTDBID(itemID)).ItemType().Type(), gamedataItemType.Con_Inhaler) {
StatusEffectHelper.ApplyStatusEffectOnSelf(game, tdbid, playerID);
// LogChannel(n"DEBUG", "Applied Status Effect: " + TDBID.ToStringDEBUG(tdbid));
if RandF() <= (RPGManager.CalculateStatModifiers(this.m_effectorChanceMods, game, player, Cast<StatsObjectID>(playerID)) / 100.0) {
// LogChannel(n"DEBUG", "Removing Item: " + TDBID.ToStringDEBUG(ItemID.GetTDBID(itemID)));
GameInstance.GetTransactionSystem(game).RemoveItem(player, itemID, 1);
};
return true;
};
return false;
}
protected func GetPlayerDrugByTDBID(game: GameInstance, matchTDBID: TweakDBID) -> ItemID {
let playersItems: array<wref<gameItemData>>;
GameInstance.GetTransactionSystem(game).GetItemListByTag(GetPlayer(game), n"Drug", playersItems);
let itemID: ItemID = ItemID.None();
let i: Int32 = 0;
let iS: Int32 = ArraySize(playersItems);
while i < iS {
itemID = playersItems[i].GetID();
if Equals(matchTDBID, ItemID.GetTDBID(itemID)) {
return itemID;
};
i += 1;
};
return ItemID.None();
}
}
141 changes: 141 additions & 0 deletions tweaks/Addicted/DrugPump.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
# Game.AddToInventory("Items.AdvancedDrugPumpCommon")
# Game.AddToInventory("Items.AdvancedDrugPumpUncommon")
# Game.AddToInventory("Items.AdvancedDrugPumpUncommonPlus")
# Game.AddToInventory("Items.AdvancedDrugPumpRare")
# Game.AddToInventory("Items.AdvancedDrugPumpRarePlus")
# Game.AddToInventory("Items.AdvancedDrugPumpEpic")
# Game.AddToInventory("Items.AdvancedDrugPumpEpicPlus")
# Game.AddToInventory("Items.AdvancedDrugPumpLegendary")
# Game.AddToInventory("Items.AdvancedDrugPumpLegendaryPlus")
# Game.AddToInventory("Items.AdvancedDrugPumpLegendaryPlusPlus")
Items.AdvancedDrugPump$(tier):
$instances: &DrugPumpInstances
- { tier: Common, upgrade: Uncommon, humanity: 4, consumechance: 90 }
- { tier: Uncommon, upgrade: UncommonPlus, humanity: 6, consumechance: 80 }
- { tier: UncommonPlus, upgrade: Rare, humanity: 6, consumechance: 80 }
- { tier: Rare, upgrade: RarePlus, humanity: 8, consumechance: 70 }
- { tier: RarePlus, upgrade: Epic, humanity: 8, consumechance: 70 }
- { tier: Epic, upgrade: EpicPlus, humanity: 10, consumechance: 60 }
- { tier: EpicPlus, upgrade: Legendary, humanity: 10, consumechance: 60 }
- { tier: Legendary, upgrade: LegendaryPlus, humanity: 12, consumechance: 50 }
- { tier: LegendaryPlus, upgrade: LegendaryPlusPlus, humanity: 12, consumechance: 50 }
- { tier: LegendaryPlusPlus, upgrade: None, humanity: 12, consumechance: 50 }
$base: Items.AdvancedBloodPump$(tier)
displayName: LocKey#Gameplay-Cyberware-DisplayName-DrugPump
localizedDescription: LocKey#Gameplay-Cyberware-LocalizedDescription-DrugPump
icon:
atlasResourcePath: addicted\gameplay\gui\common\icons\items\DrugPump.inkatlas
atlasPartName: cw_circulatory_drugpump
appearanceName: None
appearanceResourceName: None
quality: Quality.$(tier)
nextUpgradeItem: Items.AdvancedDrugPump$(upgrade)
variants:
- Variants.Humanity$(humanity)Cost
OnEquip:
- Items.AdvancedBloodPump$(tier)_inline0
- Items.AdvancedDrugPump$(tier)Logic
- Attunements.TechConsumableEffectiveness
objectActions:
- CyberwareAction.Use$(tier)DrugPump

Items.AdvancedDrugPumpNone: # Fake item to prevent error in log
$type: gamedataItem_Record
displayName: LocKey#UI-Settings-Language-Debug

Items.AdvancedDrugPump$(tier)Logic:
$instances: *DrugPumpInstances
$type: gamedataGameplayLogicPackage_Record
stackable: True
UIData:
$type: gamedataGameplayLogicPackageUIData_Record
intValues:
- $(consumechance)
localizedDescription: LocKey#Gameplay-Cyberware-Abilities-DrugPump

CyberwareAction.Use$(tier)DrugPump:
$instances: *DrugPumpInstances
$type: gamedataItemAction_Record
isDefaultLootChoice: False
removeAfterUse: False
actionName: Use
hackCategory: HackCategory.NotAHack
objectActionType: ObjectActionType.Item
priority: 0
activationTime: []
completionEffects:
- $type: gamedataObjectActionEffect_Record
effectorToTrigger: Effectors.BlackLaceVXConsumption$(tier)Chance
recipient: ObjectActionReference.Instigator
statusEffect: {}
- CyberwareAction.UseBloodPump_inline6
- CyberwareAction.UseBloodPump_inline7
- CyberwareAction.UseBloodPump_inline11
costs: []
durationTime: []
instigatorActivePrereqs: []
instigatorPrereqs:
- CyberwareAction.UseBloodPump_inline0
interruptionPrereqs: []
rewards: []
startEffects:
- ItemAction.UseHealCharge_inline0
- CyberwareAction.UseBloodPump_inline2
# - CyberwareAction.BloodPumpSFXObjectActionEffect
- CyberwareAction.BloodPumpVFXObjectActionEffect
- $type: gamedataObjectActionEffect_Record
effectorToTrigger: Effectors.DrugPumpSFX
recipient: ObjectActionReference.Instigator
statusEffect: {}
targetActivePrereqs: []
targetPrereqs: []

Effectors.BlackLaceVXConsumption$(tier)Chance:
$instances: *DrugPumpInstances
$type: gamedataApplyStatusEffectByChanceEffector_Record
statusEffect: BaseStatusEffect.Pain # Placeholder
effectorClassName: DrugPump.DrugPumpConsumptionEffector
prereqRecord: Prereqs.AlwaysTruePrereq
effectorChance:
- $type: gamedataConstantStatModifier_Record
value: $(consumechance)
modifierType: Additive
statType: BaseStats.EffectorChance

Effectors.DrugPumpSFX:
$type: gamedataEffector_Record
effectorClassName: PlaySFXEffector
prereqRecord: Prereqs.AlwaysTruePrereq
activationSFXName: vfx_fullscreen_drugged_start

Loot.MaelstromVeryRareDrop_DrugPumpCommon:
$type: gamedataLootItem_Record
itemID: Items.AdvancedDrugPumpCommon
dropChance: 0.025 # 2.5%
dropCountMax: 1
dropCountMin: 1
playerPrereqID: {}
dropChanceModifiers: []
quantityModifiers: []
statModifiers: []

LootTables.MaelstromOfficerTable:
$type: gamedataLootTable_Record
lootGenerationType: dropChance
maxItemsToLoot: 1
minItemsToLoot: 1
lootItems:
- Items.AdvancedDrugPumpCommon
lootTableInclusions: []
queries: []

Character.maelstrom_officer_officer_lexington_ma.lootDrop: LootTables.MaelstromOfficerTable

Loot.MaelstromGunnerStrongT2.lootItems:
- !append-once Loot.MaelstromVeryRareDrop_DrugPumpCommon

Loot.MaelstromShotgunStrongT2.lootItems:
- !append-once Loot.MaelstromVeryRareDrop_DrugPumpCommon

Loot.MaelstromSniperT2.lootItems:
- !append-once Loot.MaelstromVeryRareDrop_DrugPumpCommon

0 comments on commit 8632c3b

Please sign in to comment.