Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/public/simulation/ai/petra/chatHelper.js
var PETRA = function(m) | PETRA.launchAttackMessages = { | ||||
{ | |||||
m.launchAttackMessages = { | |||||
"hugeAttack": [ | "hugeAttack": [ | ||||
markForTranslation("I am starting a massive military campaign against %(_player_)s, come and join me."), | markForTranslation("I am starting a massive military campaign against %(_player_)s, come and join me."), | ||||
markForTranslation("I have set up a huge army to crush %(_player_)s. Join me and you will have your share of the loot.") | markForTranslation("I have set up a huge army to crush %(_player_)s. Join me and you will have your share of the loot.") | ||||
], | ], | ||||
"other": [ | "other": [ | ||||
markForTranslation("I am launching an attack against %(_player_)s."), | markForTranslation("I am launching an attack against %(_player_)s."), | ||||
markForTranslation("I have just sent an army against %(_player_)s.") | markForTranslation("I have just sent an army against %(_player_)s.") | ||||
] | ] | ||||
}; | }; | ||||
m.answerRequestAttackMessages = { | PETRA.answerRequestAttackMessages = { | ||||
"join": [ | "join": [ | ||||
markForTranslation("Let me regroup my army and I will then join you against %(_player_)s."), | markForTranslation("Let me regroup my army and I will then join you against %(_player_)s."), | ||||
markForTranslation("I am finishing preparations to attack %(_player_)s.") | markForTranslation("I am finishing preparations to attack %(_player_)s.") | ||||
], | ], | ||||
"decline": [ | "decline": [ | ||||
markForTranslation("Sorry, I do not have enough soldiers currently; but my next attack will target %(_player_)s."), | markForTranslation("Sorry, I do not have enough soldiers currently; but my next attack will target %(_player_)s."), | ||||
markForTranslation("Sorry, I still need to strengthen my army. However, I will attack %(_player_)s next.") | markForTranslation("Sorry, I still need to strengthen my army. However, I will attack %(_player_)s next.") | ||||
], | ], | ||||
"other": [ | "other": [ | ||||
markForTranslation("I cannot help you against %(_player_)s for the time being, I am planning to attack %(_player_2)s first.") | markForTranslation("I cannot help you against %(_player_)s for the time being, I am planning to attack %(_player_2)s first.") | ||||
] | ] | ||||
}; | }; | ||||
m.sentTributeMessages = [ | PETRA.sentTributeMessages = [ | ||||
markForTranslation("Here is a gift for you, %(_player_)s. Make good use of it."), | markForTranslation("Here is a gift for you, %(_player_)s. Make good use of it."), | ||||
markForTranslation("I see you are in a bad situation, %(_player_)s. I hope this helps."), | markForTranslation("I see you are in a bad situation, %(_player_)s. I hope this helps."), | ||||
markForTranslation("I can help you this time, %(_player_)s, but you should manage your resources more carefully in the future.") | markForTranslation("I can help you this time, %(_player_)s, but you should manage your resources more carefully in the future.") | ||||
]; | ]; | ||||
m.requestTributeMessages = [ | PETRA.requestTributeMessages = [ | ||||
markForTranslation("I am in need of %(resource)s, can you help? I will make it up to you."), | markForTranslation("I am in need of %(resource)s, can you help? I will make it up to you."), | ||||
markForTranslation("I would participate more efficiently in our common war effort if you could provide me some %(resource)s."), | markForTranslation("I would participate more efficiently in our common war effort if you could provide me some %(resource)s."), | ||||
markForTranslation("If you can spare me some %(resource)s, I will be able to strengthen my army.") | markForTranslation("If you can spare me some %(resource)s, I will be able to strengthen my army.") | ||||
]; | ]; | ||||
m.newTradeRouteMessages = [ | PETRA.newTradeRouteMessages = [ | ||||
markForTranslation("I have set up a new route with %(_player_)s. Trading will be profitable for all of us."), | markForTranslation("I have set up a new route with %(_player_)s. Trading will be profitable for all of us."), | ||||
markForTranslation("A new trade route is set up with %(_player_)s. Take your share of the profits.") | markForTranslation("A new trade route is set up with %(_player_)s. Take your share of the profits.") | ||||
]; | ]; | ||||
m.newDiplomacyMessages = { | PETRA.newDiplomacyMessages = { | ||||
"ally": [ | "ally": [ | ||||
markForTranslation("%(_player_)s and I are now allies.") | markForTranslation("%(_player_)s and I are now allies.") | ||||
], | ], | ||||
"neutral": [ | "neutral": [ | ||||
markForTranslation("%(_player_)s and I are now neutral.") | markForTranslation("%(_player_)s and I are now neutral.") | ||||
], | ], | ||||
"enemy": [ | "enemy": [ | ||||
markForTranslation("%(_player_)s and I are now enemies.") | markForTranslation("%(_player_)s and I are now enemies.") | ||||
] | ] | ||||
}; | }; | ||||
m.answerDiplomacyRequestMessages = { | PETRA.answerDiplomacyRequestMessages = { | ||||
"ally": { | "ally": { | ||||
"decline": [ | "decline": [ | ||||
markForTranslation("I cannot accept your offer to become allies, %(_player_)s.") | markForTranslation("I cannot accept your offer to become allies, %(_player_)s.") | ||||
], | ], | ||||
"declineSuggestNeutral": [ | "declineSuggestNeutral": [ | ||||
markForTranslation("I will not be your ally, %(_player_)s. However, I will consider a neutrality pact."), | markForTranslation("I will not be your ally, %(_player_)s. However, I will consider a neutrality pact."), | ||||
markForTranslation("I reject your request for alliance, %(_player_)s, but we could become neutral."), | markForTranslation("I reject your request for alliance, %(_player_)s, but we could become neutral."), | ||||
markForTranslation("%(_player_)s, only a neutrality agreement is conceivable to me.") | markForTranslation("%(_player_)s, only a neutrality agreement is conceivable to me.") | ||||
▲ Show 20 Lines • Show All 41 Lines • ▼ Show 20 Lines | "neutral": { | ||||
], | ], | ||||
"waitingForTribute": [ | "waitingForTribute": [ | ||||
markForTranslation("%(_player_)s, I will not accept your neutrality request unless you tribute me %(_amount_)s %(_resource_)s soon."), | markForTranslation("%(_player_)s, I will not accept your neutrality request unless you tribute me %(_amount_)s %(_resource_)s soon."), | ||||
markForTranslation("%(_player_)s, if you do not send me part of the %(_amount_)s %(_resource_)s tribute soon, I will break off our negotiations.") | markForTranslation("%(_player_)s, if you do not send me part of the %(_amount_)s %(_resource_)s tribute soon, I will break off our negotiations.") | ||||
] | ] | ||||
} | } | ||||
}; | }; | ||||
m.sendDiplomacyRequestMessages = { | PETRA.sendDiplomacyRequestMessages = { | ||||
"ally": { | "ally": { | ||||
"sendRequest": [ | "sendRequest": [ | ||||
markForTranslation("%(_player_)s, it would help both of our civilizations if we formed an alliance. If you become allies with me, I will respond in kind.") | markForTranslation("%(_player_)s, it would help both of our civilizations if we formed an alliance. If you become allies with me, I will respond in kind.") | ||||
], | ], | ||||
"requestExpired": [ | "requestExpired": [ | ||||
markForTranslation("%(_player_)s, my offer for an alliance has expired."), | markForTranslation("%(_player_)s, my offer for an alliance has expired."), | ||||
markForTranslation("%(_player_)s, I have rescinded my previous offer for an alliance between us."), | markForTranslation("%(_player_)s, I have rescinded my previous offer for an alliance between us."), | ||||
] | ] | ||||
}, | }, | ||||
"neutral": { | "neutral": { | ||||
"sendRequest": [ | "sendRequest": [ | ||||
markForTranslation("%(_player_)s, I would like to request a neutrality pact between our civilizations. If you become neutral with me, I will respond in kind."), | markForTranslation("%(_player_)s, I would like to request a neutrality pact between our civilizations. If you become neutral with me, I will respond in kind."), | ||||
markForTranslation("%(_player_)s, it would be both to our benefit if we negotiated a neutrality pact. I will become neutral with you if you do the same.") | markForTranslation("%(_player_)s, it would be both to our benefit if we negotiated a neutrality pact. I will become neutral with you if you do the same.") | ||||
], | ], | ||||
"requestExpired": [ | "requestExpired": [ | ||||
markForTranslation("%(_player_)s, I have decided to revoke my offer for a neutrality pact."), | markForTranslation("%(_player_)s, I have decided to revoke my offer for a neutrality pact."), | ||||
markForTranslation("%(_player_)s, as you have failed to respond to my request for peace between us, I have abrogated my offer."), | markForTranslation("%(_player_)s, as you have failed to respond to my request for peace between us, I have abrogated my offer."), | ||||
] | ] | ||||
} | } | ||||
}; | }; | ||||
m.chatLaunchAttack = function(gameState, player, type) | PETRA.chatLaunchAttack = function(gameState, player, type) | ||||
{ | { | ||||
Engine.PostCommand(PlayerID, { | Engine.PostCommand(PlayerID, { | ||||
"type": "aichat", | "type": "aichat", | ||||
"message": "/allies " + pickRandom(this.launchAttackMessages[type === "HugeAttack" ? "hugeAttack" : "other"]), | "message": "/allies " + pickRandom(this.launchAttackMessages[type === "HugeAttack" ? "hugeAttack" : "other"]), | ||||
"translateMessage": true, | "translateMessage": true, | ||||
"translateParameters": ["_player_"], | "translateParameters": ["_player_"], | ||||
"parameters": { "_player_": player } | "parameters": { "_player_": player } | ||||
}); | }); | ||||
}; | }; | ||||
m.chatAnswerRequestAttack = function(gameState, player, answer, other) | PETRA.chatAnswerRequestAttack = function(gameState, player, answer, other) | ||||
{ | { | ||||
Engine.PostCommand(PlayerID, { | Engine.PostCommand(PlayerID, { | ||||
"type": "aichat", | "type": "aichat", | ||||
"message": "/allies " + pickRandom(this.answerRequestAttackMessages[answer]), | "message": "/allies " + pickRandom(this.answerRequestAttackMessages[answer]), | ||||
"translateMessage": true, | "translateMessage": true, | ||||
"translateParameters": answer != "other" ? ["_player_"] : ["_player_", "_player_2"], | "translateParameters": answer != "other" ? ["_player_"] : ["_player_", "_player_2"], | ||||
"parameters": answer != "other" ? { "_player_": player } : { "_player_": player, "_player_2": other } | "parameters": answer != "other" ? { "_player_": player } : { "_player_": player, "_player_2": other } | ||||
}); | }); | ||||
}; | }; | ||||
m.chatSentTribute = function(gameState, player) | PETRA.chatSentTribute = function(gameState, player) | ||||
{ | { | ||||
Engine.PostCommand(PlayerID, { | Engine.PostCommand(PlayerID, { | ||||
"type": "aichat", | "type": "aichat", | ||||
"message": "/allies " + pickRandom(this.sentTributeMessages), | "message": "/allies " + pickRandom(this.sentTributeMessages), | ||||
"translateMessage": true, | "translateMessage": true, | ||||
"translateParameters": ["_player_"], | "translateParameters": ["_player_"], | ||||
"parameters": { "_player_": player } | "parameters": { "_player_": player } | ||||
}); | }); | ||||
}; | }; | ||||
m.chatRequestTribute = function(gameState, resource) | PETRA.chatRequestTribute = function(gameState, resource) | ||||
{ | { | ||||
Engine.PostCommand(PlayerID, { | Engine.PostCommand(PlayerID, { | ||||
"type": "aichat", | "type": "aichat", | ||||
"message": "/allies " + pickRandom(this.requestTributeMessages), | "message": "/allies " + pickRandom(this.requestTributeMessages), | ||||
"translateMessage": true, | "translateMessage": true, | ||||
"translateParameters": { "resource": "withinSentence" }, | "translateParameters": { "resource": "withinSentence" }, | ||||
"parameters": { "resource": Resources.GetNames()[resource] } | "parameters": { "resource": Resources.GetNames()[resource] } | ||||
}); | }); | ||||
}; | }; | ||||
m.chatNewTradeRoute = function(gameState, player) | PETRA.chatNewTradeRoute = function(gameState, player) | ||||
{ | { | ||||
Engine.PostCommand(PlayerID, { | Engine.PostCommand(PlayerID, { | ||||
"type": "aichat", | "type": "aichat", | ||||
"message": "/allies " + pickRandom(this.newTradeRouteMessages), | "message": "/allies " + pickRandom(this.newTradeRouteMessages), | ||||
"translateMessage": true, | "translateMessage": true, | ||||
"translateParameters": ["_player_"], | "translateParameters": ["_player_"], | ||||
"parameters": { "_player_": player } | "parameters": { "_player_": player } | ||||
}); | }); | ||||
}; | }; | ||||
m.chatNewPhase = function(gameState, phase, status) | PETRA.chatNewPhase = function(gameState, phase, status) | ||||
{ | { | ||||
Engine.PostCommand(PlayerID, { | Engine.PostCommand(PlayerID, { | ||||
"type": "aichat", | "type": "aichat", | ||||
"message": "/allies " + pickRandom(this.newPhaseMessages[status]), | "message": "/allies " + pickRandom(this.newPhaseMessages[status]), | ||||
"translateMessage": true, | "translateMessage": true, | ||||
"translateParameters": ["phase"], | "translateParameters": ["phase"], | ||||
"parameters": { "phase": phase } | "parameters": { "phase": phase } | ||||
}); | }); | ||||
}; | }; | ||||
m.chatNewDiplomacy = function(gameState, player, newDiplomaticStance) | PETRA.chatNewDiplomacy = function(gameState, player, newDiplomaticStance) | ||||
{ | { | ||||
Engine.PostCommand(PlayerID, { | Engine.PostCommand(PlayerID, { | ||||
"type": "aichat", | "type": "aichat", | ||||
"message": pickRandom(this.newDiplomacyMessages[newDiplomaticStance]), | "message": pickRandom(this.newDiplomacyMessages[newDiplomaticStance]), | ||||
"translateMessage": true, | "translateMessage": true, | ||||
"translateParameters": ["_player_"], | "translateParameters": ["_player_"], | ||||
"parameters": { "_player_": player } | "parameters": { "_player_": player } | ||||
}); | }); | ||||
}; | }; | ||||
m.chatAnswerRequestDiplomacy = function(gameState, player, requestType, response, requiredTribute) | PETRA.chatAnswerRequestDiplomacy = function(gameState, player, requestType, response, requiredTribute) | ||||
{ | { | ||||
Engine.PostCommand(PlayerID, { | Engine.PostCommand(PlayerID, { | ||||
"type": "aichat", | "type": "aichat", | ||||
"message": "/msg " + gameState.sharedScript.playersData[player].name + " " + | "message": "/msg " + gameState.sharedScript.playersData[player].name + " " + | ||||
pickRandom(this.answerDiplomacyRequestMessages[requestType][response]), | pickRandom(this.answerDiplomacyRequestMessages[requestType][response]), | ||||
"translateMessage": true, | "translateMessage": true, | ||||
"translateParameters": requiredTribute ? ["_amount_", "_resource_", "_player_"] : ["_player_"], | "translateParameters": requiredTribute ? ["_amount_", "_resource_", "_player_"] : ["_player_"], | ||||
"parameters": requiredTribute ? | "parameters": requiredTribute ? | ||||
{ "_amount_": requiredTribute.wanted, "_resource_": requiredTribute.type, "_player_": player } : | { "_amount_": requiredTribute.wanted, "_resource_": requiredTribute.type, "_player_": player } : | ||||
{ "_player_": player } | { "_player_": player } | ||||
}); | }); | ||||
}; | }; | ||||
m.chatNewRequestDiplomacy = function(gameState, player, requestType, status) | PETRA.chatNewRequestDiplomacy = function(gameState, player, requestType, status) | ||||
{ | { | ||||
Engine.PostCommand(PlayerID, { | Engine.PostCommand(PlayerID, { | ||||
"type": "aichat", | "type": "aichat", | ||||
"message": "/msg " + gameState.sharedScript.playersData[player].name + " " + | "message": "/msg " + gameState.sharedScript.playersData[player].name + " " + | ||||
pickRandom(this.sendDiplomacyRequestMessages[requestType][status]), | pickRandom(this.sendDiplomacyRequestMessages[requestType][status]), | ||||
"translateMessage": true, | "translateMessage": true, | ||||
"translateParameters": ["_player_"], | "translateParameters": ["_player_"], | ||||
"parameters": { "_player_": player } | "parameters": { "_player_": player } | ||||
}); | }); | ||||
}; | }; | ||||
return m; | |||||
}(PETRA); |
Wildfire Games · Phabricator