LCOV - code coverage report
Current view: top level - simulation/ai/petra - chatHelper.js (source / functions) Hit Total Coverage
Test: lcov.info Lines: 0 29 0.0 %
Date: 2023-04-02 12:52:40 Functions: 0 10 0.0 %

          Line data    Source code
       1           0 : PETRA.launchAttackMessages = {
       2             :         "hugeAttack": [
       3             :                 markForTranslation("I am starting a massive military campaign against %(_player_)s, come and join me."),
       4             :                 markForTranslation("I have set up a huge army to crush %(_player_)s. Join me and you will have your share of the loot.")
       5             :         ],
       6             :         "other": [
       7             :                 markForTranslation("I am launching an attack against %(_player_)s."),
       8             :                 markForTranslation("I have just sent an army against %(_player_)s.")
       9             :         ]
      10             : };
      11             : 
      12           0 : PETRA.answerRequestAttackMessages = {
      13             :         "join": [
      14             :                 markForTranslation("Let me regroup my army and I will then join you against %(_player_)s."),
      15             :                 markForTranslation("I am finishing preparations to attack %(_player_)s.")
      16             :         ],
      17             :         "decline": [
      18             :                 markForTranslation("Sorry, I do not have enough soldiers currently; but my next attack will target %(_player_)s."),
      19             :                 markForTranslation("Sorry, I still need to strengthen my army. However, I will attack %(_player_)s next.")
      20             :         ],
      21             :         "other": [
      22             :                 markForTranslation("I cannot help you against %(_player_)s for the time being, I am planning to attack %(_player_2)s first.")
      23             :         ]
      24             : };
      25             : 
      26           0 : PETRA.sentTributeMessages = [
      27             :         markForTranslation("Here is a gift for you, %(_player_)s. Make good use of it."),
      28             :         markForTranslation("I see you are in a bad situation, %(_player_)s. I hope this helps."),
      29             :         markForTranslation("I can help you this time, %(_player_)s, but you should manage your resources more carefully in the future.")
      30             : ];
      31             : 
      32           0 : PETRA.requestTributeMessages = [
      33             :         markForTranslation("I am in need of %(resource)s, can you help? I will make it up to you."),
      34             :         markForTranslation("I would participate more efficiently in our common war effort if you could provide me some %(resource)s."),
      35             :         markForTranslation("If you can spare me some %(resource)s, I will be able to strengthen my army.")
      36             : ];
      37             : 
      38           0 : PETRA.newTradeRouteMessages = [
      39             :         markForTranslation("I have set up a new route with %(_player_)s. Trading will be profitable for all of us."),
      40             :         markForTranslation("A new trade route is set up with %(_player_)s. Take your share of the profits.")
      41             : ];
      42             : 
      43           0 : PETRA.newDiplomacyMessages = {
      44             :         "ally": [
      45             :                 markForTranslation("%(_player_)s and I are now allies.")
      46             :         ],
      47             :         "neutral": [
      48             :                 markForTranslation("%(_player_)s and I are now neutral.")
      49             :         ],
      50             :         "enemy": [
      51             :                 markForTranslation("%(_player_)s and I are now enemies.")
      52             :         ]
      53             : };
      54             : 
      55           0 : PETRA.answerDiplomacyRequestMessages = {
      56             :         "ally": {
      57             :                 "decline": [
      58             :                         markForTranslation("I cannot accept your offer to become allies, %(_player_)s.")
      59             :                 ],
      60             :                 "declineSuggestNeutral": [
      61             :                         markForTranslation("I will not be your ally, %(_player_)s. However, I will consider a neutrality pact."),
      62             :                         markForTranslation("I reject your request for alliance, %(_player_)s, but we could become neutral."),
      63             :                         markForTranslation("%(_player_)s, only a neutrality agreement is conceivable to me.")
      64             :                 ],
      65             :                 "declineRepeatedOffer": [
      66             :                         markForTranslation("Our previous alliance did not work out, %(_player_)s. I must decline your offer."),
      67             :                         markForTranslation("I won’t ally you again, %(_player_)s!"),
      68             :                         markForTranslation("No more alliances between us, %(_player_)s!"),
      69             :                         markForTranslation("Your request for peace means nothing to me anymore, %(_player_)s!"),
      70             :                         markForTranslation("My answer to your repeated peace proposal will remain war, %(_player_)s!")
      71             :                 ],
      72             :                 "accept": [
      73             :                         markForTranslation("I will accept your offer to become allies, %(_player_)s. We will both benefit from this partnership."),
      74             :                         markForTranslation("An alliance between us is a good idea, %(_player_)s."),
      75             :                         markForTranslation("Let both of our people prosper from a peaceful association, %(_player_)s."),
      76             :                         markForTranslation("We have found common ground, %(_player_)s. I accept the alliance."),
      77             :                         markForTranslation("%(_player_)s, consider us allies from now on.")
      78             :                 ],
      79             :                 "acceptWithTribute": [
      80             :                         markForTranslation("I will ally with you, %(_player_)s, but only if you send me a tribute of %(_amount_)s %(_resource_)s."),
      81             :                         markForTranslation("%(_player_)s, you must send me a tribute of %(_amount_)s %(_resource_)s before I accept an alliance with you."),
      82             :                         markForTranslation("Unless you send me %(_amount_)s %(_resource_)s, an alliance won’t be formed, %(_player_)s.")
      83             :                 ],
      84             :                 "waitingForTribute": [
      85             :                         markForTranslation("%(_player_)s, my offer still stands. I will ally with you only if you send me a tribute of %(_amount_)s %(_resource_)s."),
      86             :                         markForTranslation("I’m still waiting for %(_amount_)s %(_resource_)s before accepting your alliance, %(_player_)s."),
      87             :                         markForTranslation("%(_player_)s, if you do not send me part of the %(_amount_)s %(_resource_)s tribute soon, I will break off our negotiations.")
      88             :                 ]
      89             :         },
      90             :         "neutral": {
      91             :                 "decline": [
      92             :                         markForTranslation("I will not become neutral with you, %(_player_)s."),
      93             :                         markForTranslation("%(_player_)s, I must decline your request for a neutrality pact.")
      94             :                 ],
      95             :                 "declineRepeatedOffer": [
      96             :                         markForTranslation("Our previous neutrality agreement ended in failure, %(_player_)s; I will not consider another one.")
      97             :                 ],
      98             :                 "accept": [
      99             :                         markForTranslation("I welcome your request for peace between our civilizations, %(_player_)s. I will accept."),
     100             :                         markForTranslation("%(_player_)s, I will accept your neutrality request. May both our civilizations benefit.")
     101             :                 ],
     102             :                 "acceptWithTribute": [
     103             :                         markForTranslation("If you send me a tribute of %(_amount_)s %(_resource_)s, I will accept your neutrality request, %(_player_)s."),
     104             :                         markForTranslation("%(_player_)s, if you send me %(_amount_)s %(_resource_)s, I will accept a neutrality pact.")
     105             :                 ],
     106             :                 "waitingForTribute": [
     107             :                         markForTranslation("%(_player_)s, I will not accept your neutrality request unless you tribute me %(_amount_)s %(_resource_)s soon."),
     108             :                         markForTranslation("%(_player_)s, if you do not send me part of the %(_amount_)s %(_resource_)s tribute soon, I will break off our negotiations.")
     109             :                 ]
     110             :         }
     111             : };
     112             : 
     113           0 : PETRA.sendDiplomacyRequestMessages = {
     114             :         "ally": {
     115             :                 "sendRequest": [
     116             :                         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.")
     117             :                 ],
     118             :                 "requestExpired": [
     119             :                         markForTranslation("%(_player_)s, my offer for an alliance has expired."),
     120             :                         markForTranslation("%(_player_)s, I have rescinded my previous offer for an alliance between us."),
     121             :                 ]
     122             :         },
     123             :         "neutral": {
     124             :                 "sendRequest": [
     125             :                         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."),
     126             :                         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.")
     127             :                 ],
     128             :                 "requestExpired": [
     129             :                         markForTranslation("%(_player_)s, I have decided to revoke my offer for a neutrality pact."),
     130             :                         markForTranslation("%(_player_)s, as you have failed to respond to my request for peace between us, I have abrogated my offer."),
     131             :                 ]
     132             :         }
     133             : };
     134             : 
     135           0 : PETRA.emergencyMessages = {
     136             :         "enter": [
     137             :                 markForTranslation("My armies failed while defending my empire. Please honor our alliance and send help!")
     138             :         ],
     139             :         "exit": [
     140             :                 markForTranslation("My empire regained its old strength, now it is time to seek revenge together!")
     141             :         ]
     142             : };
     143             : 
     144           0 : PETRA.chatLaunchAttack = function(gameState, player, type)
     145             : {
     146           0 :         Engine.PostCommand(PlayerID, {
     147             :                 "type": "aichat",
     148             :                 "message": "/allies " + pickRandom(this.launchAttackMessages[type === PETRA.AttackPlan.TYPE_HUGE_ATTACK ? "hugeAttack" : "other"]),
     149             :                 "translateMessage": true,
     150             :                 "translateParameters": ["_player_"],
     151             :                 "parameters": { "_player_": player }
     152             :         });
     153             : };
     154             : 
     155           0 : PETRA.chatAnswerRequestAttack = function(gameState, player, answer, other)
     156             : {
     157           0 :         Engine.PostCommand(PlayerID, {
     158             :                 "type": "aichat",
     159             :                 "message": "/allies " + pickRandom(this.answerRequestAttackMessages[answer]),
     160             :                 "translateMessage": true,
     161             :                 "translateParameters": answer != "other" ? ["_player_"] : ["_player_", "_player_2"],
     162             :                 "parameters": answer != "other" ? { "_player_": player } : { "_player_": player, "_player_2": other }
     163             :         });
     164             : };
     165             : 
     166           0 : PETRA.chatSentTribute = function(gameState, player)
     167             : {
     168           0 :         Engine.PostCommand(PlayerID, {
     169             :                 "type": "aichat",
     170             :                 "message": "/allies " + pickRandom(this.sentTributeMessages),
     171             :                 "translateMessage": true,
     172             :                 "translateParameters": ["_player_"],
     173             :                 "parameters": { "_player_": player }
     174             :         });
     175             : };
     176             : 
     177           0 : PETRA.chatRequestTribute = function(gameState, resource)
     178             : {
     179           0 :         Engine.PostCommand(PlayerID, {
     180             :                 "type": "aichat",
     181             :                 "message": "/allies " + pickRandom(this.requestTributeMessages),
     182             :                 "translateMessage": true,
     183             :                 "translateParameters": { "resource": "withinSentence" },
     184             :                 "parameters": { "resource": Resources.GetNames()[resource] }
     185             :         });
     186             : };
     187             : 
     188           0 : PETRA.chatNewTradeRoute = function(gameState, player)
     189             : {
     190           0 :         Engine.PostCommand(PlayerID, {
     191             :                 "type": "aichat",
     192             :                 "message": "/allies " + pickRandom(this.newTradeRouteMessages),
     193             :                 "translateMessage": true,
     194             :                 "translateParameters": ["_player_"],
     195             :                 "parameters": { "_player_": player }
     196             :         });
     197             : };
     198             : 
     199           0 : PETRA.chatNewPhase = function(gameState, phase, status)
     200             : {
     201           0 :         Engine.PostCommand(PlayerID, {
     202             :                 "type": "aichat",
     203             :                 "message": "/allies " + pickRandom(this.newPhaseMessages[status]),
     204             :                 "translateMessage": true,
     205             :                 "translateParameters": ["phase"],
     206             :                 "parameters": { "phase": phase }
     207             :         });
     208             : };
     209             : 
     210           0 : PETRA.chatNewDiplomacy = function(gameState, player, newDiplomaticStance)
     211             : {
     212           0 :         Engine.PostCommand(PlayerID, {
     213             :                 "type": "aichat",
     214             :                 "message": pickRandom(this.newDiplomacyMessages[newDiplomaticStance]),
     215             :                 "translateMessage": true,
     216             :                 "translateParameters": ["_player_"],
     217             :                 "parameters": { "_player_": player }
     218             :         });
     219             : };
     220             : 
     221           0 : PETRA.chatAnswerRequestDiplomacy = function(gameState, player, requestType, response, requiredTribute)
     222             : {
     223           0 :         Engine.PostCommand(PlayerID, {
     224             :                 "type": "aichat",
     225             :                 "message": "/msg " + gameState.sharedScript.playersData[player].name + " " +
     226             :                         pickRandom(this.answerDiplomacyRequestMessages[requestType][response]),
     227             :                 "translateMessage": true,
     228             :                 "translateParameters": requiredTribute ? { "_amount_": null, "_resource_": "withinSentence", "_player_": null } : ["_player_"],
     229             :                 "parameters": requiredTribute ?
     230             :                         { "_amount_": requiredTribute.wanted, "_resource_": Resources.GetNames()[requiredTribute.type], "_player_": player } :
     231             :                         { "_player_": player }
     232             :         });
     233             : };
     234             : 
     235           0 : PETRA.chatNewRequestDiplomacy = function(gameState, player, requestType, status)
     236             : {
     237           0 :         Engine.PostCommand(PlayerID, {
     238             :                 "type": "aichat",
     239             :                 "message": "/msg " + gameState.sharedScript.playersData[player].name + " " +
     240             :                         pickRandom(this.sendDiplomacyRequestMessages[requestType][status]),
     241             :                 "translateMessage": true,
     242             :                 "translateParameters": ["_player_"],
     243             :                 "parameters": { "_player_": player }
     244             :         });
     245             : };
     246             : 
     247           0 : PETRA.chatEmergency = function(gameState, enable)
     248             : {
     249           0 :         Engine.PostCommand(PlayerID, {
     250             :                 "type": "aichat",
     251             :                 "message": "/allies " + pickRandom(this.emergencyMessages[enable ? "enter" : "exit"]),
     252             :                 "translateMessage": true
     253             :         });
     254             : };

Generated by: LCOV version 1.14