Skip to content

Commit

Permalink
fix and standardize actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Demeter29 committed Oct 9, 2024
1 parent f612348 commit 0918df6
Show file tree
Hide file tree
Showing 20 changed files with 196 additions and 380 deletions.
18 changes: 15 additions & 3 deletions default_userdata/scripts/actions/standard/aiGetsWounded.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ module.exports = {
args: [],
description: `execute when {{aiName}} gets seriously wounded.`,
group: "fight",
check: (conv) =>{
return true;
check: (gameData) =>{
const char = gameData.characters.get(gameData.aiID);

return !hasTrait(char, "Wounded")
},
run: (gameData, runFileManager) => {
runFileManager.append(
Expand All @@ -16,6 +18,16 @@ module.exports = {
chatMessage: () =>{
return `{{aiName}} got wounded!`
},
chatMessageClass: "negative-interaction-message"
chatMessageClass: "negative-action-message"
}

function hasTrait(char, traitName){
let output = false;
char.traits.forEach(trait => {
if(trait.name === traitName){
output = true;
}
});

return output
}
40 changes: 40 additions & 0 deletions default_userdata/scripts/actions/standard/becomeCloseFriends.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
module.exports = {
signature: "becomeCloseFriends",
args: [
{
name: "reason",
type: "string",
desc: "the reason (the event) that made them become friends. (write it in past tense)."
}
],
description: "Trigger when a strong and close friendship forms between {{playerName}} and {{aiName}}.",
check: (gameData) => {
let ai = gameData.characters.get(gameData.aiID);
return (getConversationOpinionValue(ai.opinionBreakdownToPlayer) > 35) &&
(ai.opinionOfPlayer > 0) &&
!ai.relationsToPlayer.includes("Friend")
},
run: (gameData, runFileManager, args) => {
console.log(args[0])
runFileManager.append(`global_var:talk_second_scope = {
set_relation_friend = { reason = ${args[0]} target = global_var:talk_first_scope }
}`)
},
chatMessage: (args) =>{
return `{{aiName}} has become your friend.`
},
chatMessageClass: "positive-action-message"
}
//help functions
function getConversationOpinionValue(opinionBreakdown){
let results = opinionBreakdown.filter( (opinionModifier) =>{
return opinionModifier.reason == "From conversations";
})

let conversationOpinion = 0;
if(results.length>0){
conversationOpinion = results[0].value;
}

return conversationOpinion;
}
37 changes: 37 additions & 0 deletions default_userdata/scripts/actions/standard/becomeRivals.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
module.exports = {
signature: "becomeRivals",
args: [
{
name: "reason",
type: "string",
desc: "the reason (the event) that made them become rivals with eachother. (write it in past tense)."
}
],
description: "Trigger when something drastic happens and {{playerName}} and {{aiName}} become rivals with eachother. it's enough of {{aiName}} does something that {playerName}} really didn't like.",
check: (gameData) => {
return true;
},
run: (gameData, runFileManager, args) => {
console.log(args[0])
runFileManager.append(`global_var:talk_second_scope = {
set_relation_rival = { reason = ${args[0]} target = global_var:talk_first_scope }
}`)
},
chatMessage: (args) =>{
return `{{aiName}} has become your rival.`
},
chatMessageClass: "negative-action-message"
}
//help functions
function getConversationOpinionValue(opinionBreakdown){
let results = opinionBreakdown.filter( (opinionModifier) =>{
return opinionModifier.reason == "From conversations";
})

let conversationOpinion = 0;
if(results.length>0){
conversationOpinion = results[0].value;
}

return conversationOpinion;
}
6 changes: 3 additions & 3 deletions default_userdata/scripts/actions/standard/emotionHappy.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module.exports = {
args: [],
description: `execute when {{aiName}} is feeling happy.`,
group: "emotion",
check: (conv) =>{
check: (gameData) =>{
return true;
},
run: (gameData, runFileManager) => {
Expand All @@ -15,8 +15,8 @@ module.exports = {
)
},
chatMessage: () =>{
return `emotion: happy`

},
chatMessageClass: "neutral-interaction-message"
chatMessageClass: null
}

4 changes: 2 additions & 2 deletions default_userdata/scripts/actions/standard/emotionPain.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ module.exports = {
)
},
chatMessage: () =>{
return `emotion: pain`

},
chatMessageClass: "neutral-interaction-message"
chatMessageClass: null
}

4 changes: 2 additions & 2 deletions default_userdata/scripts/actions/standard/emotionSad.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ module.exports = {
)
},
chatMessage: () =>{
return `emotion: sad`

},
chatMessageClass: "neutral-interaction-message"
chatMessageClass: null
}

4 changes: 2 additions & 2 deletions default_userdata/scripts/actions/standard/emotionWorry.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ module.exports = {
)
},
chatMessage: () =>{
return `emotion: worry`

},
chatMessageClass: "neutral-interaction-message"
chatMessageClass: null
}

Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ module.exports = {
],
description: `execute when {{playerName}}'s last dialogue or action drastically improved {{aiName}}'s opinion of {{playerName}}.`,
group: "opinion",
check: (gameData) =>{
return (getConversationOpinionValue(gameData.characters.get(gameData.aiID).opinionBreakdownToPlayer) < 50)
},
run: (gameData, runFileManager, args) =>{
let conversationOpinion = getConversationOpinionValue(gameData.characters.get(gameData.aiID).opinionBreakdownToPlayer)
if(conversationOpinion<50){
Expand All @@ -33,7 +36,7 @@ module.exports = {
chatMessage: (args) =>{
return `{{aiName}}'s opinion of you has improved by ${args[0]}.`
},
chatMessageClass: "positive-interaction-message"
chatMessageClass: "positive-action-message"
}

//help functions
Expand Down
12 changes: 9 additions & 3 deletions default_userdata/scripts/actions/standard/intercourse.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,23 @@
module.exports = {
signature: "intercourse",
args: [],
description: `execute when {{aiName}} and {{playerName}} had sexual intercourse, only trigger when the act is finished`,
description: `execute when {{aiName}} and {{playerName}} has sexual intercourse, only trigger when the act is finished, the act can both be consensual or rape`,
group: "",
check: (gameData) => {
return true;
},
run: (gameData, runFileManager) => {
runFileManager.append(`
global_var:talk_first_scope = {
intercourse_with_character_effect = { INTERCOURSE_CHARACTER = scope:talk_second_scope }
had_sex_with_effect = {
CHARACTER = global_var:talk_second_scope
PREGNANCY_CHANCE = pregnancy_chance
}
}
`);
},
chatMessage: (args) =>{
return `you layed with {{aiName}}`
},
chatMessageClass: "neutral-interaction-message"
chatMessageClass: "neutral-action-message"
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ module.exports = {
],
description: `execute when {{playerName}}'s last single dialogue or action drastically lowered {{aiName}}'s opinion of {{playerName}}.`,
group: "opinion",
check: (conv) =>{
getConversationOpinionValue(conv.gameData.opinionBreakdownToPlayer)>-50;
check: (gameData) =>{
return (getConversationOpinionValue(gameData.characters.get(gameData.aiID).opinionBreakdownToPlayer) > -50);
},
run: (gameData, runFileManager, args) => {
let conversationOpinion = getConversationOpinionValue(gameData.characters.get(gameData.aiID).opinionBreakdownToPlayer)
Expand All @@ -22,7 +22,7 @@ module.exports = {
add_opinion = {
target = global_var:talk_first_scope
modifier = conversation_opinion
opinion = ${args[0]}
opinion = -${args[0]}
}
}`
)
Expand All @@ -31,7 +31,7 @@ module.exports = {
chatMessage: (args) =>{
return `{{aiName}}'s opinion of you has decreased by ${args[0]}.`
},
chatMessageClass: "negative-interaction-message"
chatMessageClass: "negative-action-message"
}

//help functions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ module.exports = {
],
description: `execute when {{playerName}} pays gold to {{aiName}} and {{aiName}} accepts it.`,
group: "",
check: (gameData) => {
return true;
},
run: (gameData, runFileManager) => {
runFileManager.append(`
global_var:talk_second_scope = {
Expand All @@ -24,5 +27,5 @@ module.exports = {
chatMessage: (args) =>{
return `You paid ${args[0]} gold to {{aiName}}`
},
chatMessageClass: "neutral-interaction-message"
chatMessageClass: "neutral-action-message"
}
5 changes: 4 additions & 1 deletion default_userdata/scripts/actions/standard/undressAi.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ module.exports = {
args: [],
description: `execute when {{aiName}} gets undressed either willingly or forcefully against her wish.`,
group: "",
check: (gameData) => {
return true;
},
run: (gameData, runFileManager) => {
runFileManager.append(`
global_var:talk_second_scope = {
Expand All @@ -16,5 +19,5 @@ module.exports = {
chatMessage: (args) =>{
return `{{aiName}} got undressed`
},
chatMessageClass: "neutral-interaction-message"
chatMessageClass: "neutral-action-message"
}
Loading

0 comments on commit 0918df6

Please sign in to comment.