1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-12 02:28:11 +02:00

Merge branch 'develop' into MakeWOGGreatAgain

This commit is contained in:
Dydzio 2017-02-01 23:14:36 +01:00 committed by GitHub
commit 6c8ef79727
18 changed files with 423 additions and 289 deletions

View File

@ -2823,10 +2823,10 @@ void VCAI::requestSent(const CPackForServer *pack, int requestID)
std::string VCAI::getBattleAIName() const
{
if(settings["server"]["neutralAI"].getType() == JsonNode::DATA_STRING)
return settings["server"]["neutralAI"].String();
if(settings["server"]["enemyAI"].getType() == JsonNode::DATA_STRING)
return settings["server"]["enemyAI"].String();
else
return "StupidAI";
return "BattleAI";
}
void VCAI::validateObject(const CGObjectInstance *obj)

View File

@ -659,7 +659,7 @@ void CPlayerInterface::battleStart(const CCreatureSet *army1, const CCreatureSet
EVENT_HANDLER_CALLED_BY_CLIENT;
if (settings["adventure"]["quickCombat"].Bool())
{
autofightingAI = CDynLibHandler::getNewBattleAI(settings["server"]["neutralAI"].String());
autofightingAI = CDynLibHandler::getNewBattleAI(settings["server"]["friendlyAI"].String());
autofightingAI->init(cb);
autofightingAI->battleStart(army1, army2, int3(0,0,0), hero1, hero2, side);
isAutoFightOn = true;

View File

@ -856,7 +856,7 @@ void CBattleInterface::bAutofightf()
curInt->isAutoFightOn = true;
blockUI(true);
auto ai = CDynLibHandler::getNewBattleAI(settings["server"]["neutralAI"].String());
auto ai = CDynLibHandler::getNewBattleAI(settings["server"]["friendlyAI"].String());
ai->init(curInt->cb);
ai->battleStart(army1, army2, int3(0,0,0), attackingHeroInstance, defendingHeroInstance, curInt->cb->battleGetMySide());
curInt->autofightingAI = ai;

View File

@ -17,6 +17,12 @@
"name": "Additional retaliations",
"description": "May Retaliate ${val} extra times"
},
"CATAPULT_EXTRA_SHOTS":
{
"name": "Additional siege attacks",
"description": "Can hit siege walls ${val} extra times per attack"
},
"AIR_IMMUNITY":
{

View File

@ -401,6 +401,12 @@
"subtype" : "spell.protectEarth",
"val" : 2
},
"meteorShowerVulnerability" :
{
"type" : "MORE_DAMAGE_FROM_SPELL",
"subtype" : "spell.meteorShower",
"val" : 100
},
"lightingImmunity" :
{
"type" : "SPELL_IMMUNITY",

View File

@ -269,6 +269,14 @@
"index": 95,
"level": 6,
"faction": "stronghold",
"abilities":
{
"siegeDoubleAttack" :
{
"type" : "CATAPULT_EXTRA_SHOTS",
"val" : 1
}
},
"graphics" :
{
"animation": "CCYCLLOR.DEF",

View File

@ -212,7 +212,7 @@
"type" : "object",
"additionalProperties" : false,
"default": {},
"required" : [ "server", "port", "localInformation", "playerAI", "neutralAI" ],
"required" : [ "server", "port", "localInformation", "playerAI", "friendlyAI","neutralAI", "enemyAI" ],
"properties" : {
"server" : {
"type":"string",
@ -230,9 +230,17 @@
"type" : "string",
"default" : "VCAI"
},
"friendlyAI" : {
"type" : "string",
"default" : "BattleAI"
},
"neutralAI" : {
"type" : "string",
"default" : "StupidAI"
},
"enemyAI" : {
"type" : "string",
"default" : "BattleAI"
}
}
},

View File

@ -1,14 +1,13 @@
#include <QApplication>
#include "StdInc.h"
#include "mainwindow_moc.h"
#include <QApplication>
#include "sdldisplayquery.h"
int main(int argc, char *argv[])
{
QApplication vcmilauncher(argc, argv);
auto displayList = getDisplays();
QApplication a(argc, argv);
MainWindow w(displayList);
w.show();
return a.exec();
MainWindow mainWindow(displayList);
mainWindow.show();
return vcmilauncher.exec();
}

View File

@ -84,5 +84,4 @@ void MainWindow::startExecutable(QString name)
QMessageBox::Ok);
return;
}
}

View File

@ -11,7 +11,8 @@ class QTableWidgetItem;
class MainWindow : public QMainWindow
{
Q_OBJECT
private:
Ui::MainWindow *ui;
void load();
void startExecutable(QString name);
public:
@ -20,7 +21,4 @@ public:
private slots:
void on_startGameButton_clicked();
private:
Ui::MainWindow *ui;
};

View File

@ -45,10 +45,14 @@ void CSettingsView::loadSettings()
ui->comboBoxFullScreen->setCurrentIndex(settings["video"]["fullscreen"].Bool());
ui->comboBoxShowIntro->setCurrentIndex(settings["video"]["showIntro"].Bool());
int friendlyAIIndex = ui->comboBoxFriendlyAI->findText(QString::fromUtf8(settings["server"]["friendlyAI"].String().c_str()));
int neutralAIIndex = ui->comboBoxNeutralAI->findText(QString::fromUtf8(settings["server"]["neutralAI"].String().c_str()));
int enemyAIIndex = ui->comboBoxEnemyAI->findText(QString::fromUtf8(settings["server"]["enemyAI"].String().c_str()));
int playerAIIndex = ui->comboBoxPlayerAI->findText(QString::fromUtf8(settings["server"]["playerAI"].String().c_str()));
ui->comboBoxFriendlyAI->setCurrentIndex(friendlyAIIndex);
ui->comboBoxNeutralAI->setCurrentIndex(neutralAIIndex);
ui->comboBoxEnemyAI->setCurrentIndex(enemyAIIndex);
ui->comboBoxPlayerAI->setCurrentIndex(playerAIIndex);
ui->spinBoxNetworkPort->setValue(settings["server"]["port"].Float());
@ -118,12 +122,24 @@ void CSettingsView::on_comboBoxPlayerAI_currentIndexChanged(const QString &arg1)
node->String() = arg1.toUtf8().data();
}
void CSettingsView::on_comboBoxFriendlyAI_currentIndexChanged(const QString & arg1)
{
Settings node = settings.write["server"]["friendlyAI"];
node->String() = arg1.toUtf8().data();
}
void CSettingsView::on_comboBoxNeutralAI_currentIndexChanged(const QString &arg1)
{
Settings node = settings.write["server"]["neutralAI"];
node->String() = arg1.toUtf8().data();
}
void CSettingsView::on_comboBoxEnemyAI_currentIndexChanged(const QString & arg1)
{
Settings node = settings.write["server"]["enemyAI"];
node->String() = arg1.toUtf8().data();
}
void CSettingsView::on_spinBoxNetworkPort_valueChanged(int arg1)
{
Settings node = settings.write["server"]["port"];

View File

@ -1,5 +1,4 @@
#pragma once
#include "../StdInc.h"
namespace Ui {
@ -9,7 +8,6 @@ namespace Ui {
class CSettingsView : public QWidget
{
Q_OBJECT
public:
explicit CSettingsView(QWidget *parent = 0);
~CSettingsView();
@ -24,8 +22,12 @@ private slots:
void on_comboBoxPlayerAI_currentIndexChanged(const QString &arg1);
void on_comboBoxFriendlyAI_currentIndexChanged(const QString &arg1);
void on_comboBoxNeutralAI_currentIndexChanged(const QString &arg1);
void on_comboBoxEnemyAI_currentIndexChanged(const QString &arg1);
void on_spinBoxNetworkPort_valueChanged(int arg1);
void on_plainTextEditRepos_textChanged();

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>714</width>
<height>429</height>
<width>738</width>
<height>459</height>
</rect>
</property>
<property name="windowTitle">
@ -26,8 +26,8 @@
<property name="bottomMargin">
<number>0</number>
</property>
<item row="10" column="1" colspan="4">
<widget class="QLabel" name="LauncherSettings">
<item row="0" column="6" colspan="4">
<widget class="QLabel" name="labelDataDirs">
<property name="font">
<font>
<weight>75</weight>
@ -35,7 +35,89 @@
</font>
</property>
<property name="text">
<string>Launcher Settings</string>
<string>Data Directories</string>
</property>
</widget>
</item>
<item row="0" column="1" colspan="4">
<widget class="QLabel" name="labelVideo">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Video</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="labelResolution">
<property name="text">
<string>Resolution</string>
</property>
</widget>
</item>
<item row="3" column="9">
<widget class="QPushButton" name="openTempDir">
<property name="text">
<string>Open</string>
</property>
</widget>
</item>
<item row="9" column="4">
<widget class="QComboBox" name="comboBoxNeutralAI">
<item>
<property name="text">
<string>BattleAI</string>
</property>
</item>
<item>
<property name="text">
<string>StupidAI</string>
</property>
</item>
</widget>
</item>
<item row="2" column="6">
<widget class="QLabel" name="labelUserDataDir">
<property name="text">
<string>User data directory</string>
</property>
</widget>
</item>
<item row="12" column="1">
<widget class="QLabel" name="labelEnemyAI">
<property name="minimumSize">
<size>
<width>0</width>
<height>22</height>
</size>
</property>
<property name="text">
<string>Enemy AI</string>
</property>
</widget>
</item>
<item row="15" column="1" colspan="4">
<widget class="QLabel" name="labelAutoCheck">
<property name="text">
<string>Check repositories on startup</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLabel" name="labelDisplayIndex">
<property name="text">
<string>Display index</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLabel" name="labelShowIntro">
<property name="text">
<string>Show intro</string>
</property>
</widget>
</item>
@ -52,10 +134,94 @@
</property>
</widget>
</item>
<item row="2" column="6">
<widget class="QLabel" name="labelUserDataDir">
<item row="4" column="4">
<widget class="QComboBox" name="comboBoxDisplayIndex">
<item>
<property name="text">
<string>0</string>
</property>
</item>
</widget>
</item>
<item row="1" column="8">
<widget class="QPushButton" name="changeGameDataDir">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>User data directory</string>
<string>Change</string>
</property>
</widget>
</item>
<item row="7" column="4">
<widget class="QComboBox" name="comboBoxPlayerAI">
<item>
<property name="text">
<string>VCAI</string>
</property>
</item>
</widget>
</item>
<item row="3" column="7" colspan="2">
<widget class="QLineEdit" name="lineEditTempDir">
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>/home/user/.vcmi</string>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="6">
<widget class="QLabel" name="labelTempDir">
<property name="text">
<string>Log files directory</string>
</property>
</widget>
</item>
<item row="15" column="6">
<widget class="QComboBox" name="comboBoxAutoCheck">
<property name="currentIndex">
<number>1</number>
</property>
<item>
<property name="text">
<string>Off</string>
</property>
</item>
<item>
<property name="text">
<string>On</string>
</property>
</item>
</widget>
</item>
<item row="16" column="1" colspan="4">
<widget class="QLabel" name="labelRepositories">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Repositories</string>
</property>
</widget>
</item>
<item row="1" column="9">
<widget class="QPushButton" name="openGameDataDir">
<property name="text">
<string>Open</string>
</property>
</widget>
</item>
@ -72,13 +238,122 @@
</property>
</widget>
</item>
<item row="1" column="8">
<widget class="QPushButton" name="changeGameDataDir">
<item row="18" column="1" colspan="9">
<widget class="QPlainTextEdit" name="plainTextEditRepos">
<property name="lineWrapMode">
<enum>QPlainTextEdit::NoWrap</enum>
</property>
<property name="plainText">
<string>http://downloads.vcmi.eu/Mods/repository.json</string>
</property>
</widget>
</item>
<item row="2" column="9">
<widget class="QPushButton" name="openUserDataDir">
<property name="text">
<string>Open</string>
</property>
</widget>
</item>
<item row="11" column="1">
<widget class="QLabel" name="labelFriendlyAI">
<property name="minimumSize">
<size>
<width>0</width>
<height>22</height>
</size>
</property>
<property name="text">
<string>Friendly AI</string>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="QLabel" name="labelPlayerAI">
<property name="text">
<string>Player AI</string>
</property>
</widget>
</item>
<item row="12" column="4">
<widget class="QComboBox" name="comboBoxEnemyAI">
<property name="editable">
<bool>false</bool>
</property>
<property name="currentText">
<string>BattleAI</string>
</property>
<item>
<property name="text">
<string>BattleAI</string>
</property>
</item>
<item>
<property name="text">
<string>StupidAI</string>
</property>
</item>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="labelFullScreen">
<property name="text">
<string>Fullscreen</string>
</property>
</widget>
</item>
<item row="5" column="1" colspan="4">
<spacer name="spacerSections">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>56</width>
<height>8</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="7">
<widget class="QLineEdit" name="lineEditGameDir">
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>/usr/share/vcmi</string>
</property>
</widget>
</item>
<item row="1" column="6">
<widget class="QLabel" name="labelGameDir">
<property name="text">
<string>Extra data directory</string>
</property>
</widget>
</item>
<item row="2" column="7" colspan="2">
<widget class="QLineEdit" name="lineEditUserDataDir">
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Change</string>
<string>/home/user/.vcmi</string>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
@ -100,7 +375,7 @@
</widget>
</item>
<item row="6" column="1" colspan="4">
<widget class="QLabel" name="labelAISettings">
<widget class="QLabel" name="labelAIMovingOnTheMap">
<property name="font">
<font>
<weight>75</weight>
@ -108,21 +383,44 @@
</font>
</property>
<property name="text">
<string>AI Settings</string>
<string>AI on the map</string>
</property>
</widget>
</item>
<item row="1" column="9">
<widget class="QPushButton" name="openGameDataDir">
<item row="3" column="4">
<widget class="QComboBox" name="comboBoxShowIntro">
<property name="currentIndex">
<number>1</number>
</property>
<item>
<property name="text">
<string>Off</string>
</property>
</item>
<item>
<property name="text">
<string>On</string>
</property>
</item>
</widget>
</item>
<item row="14" column="1" colspan="4">
<widget class="QLabel" name="LauncherSettings">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Open</string>
<string>Launcher Settings</string>
</property>
</widget>
</item>
<item row="1" column="6">
<widget class="QLabel" name="labelGameDir">
<item row="7" column="6">
<widget class="QLabel" name="labelNetworkPort">
<property name="text">
<string>Extra data directory</string>
<string>Network port</string>
</property>
</widget>
</item>
@ -185,101 +483,42 @@
</item>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="labelFullScreen">
<property name="text">
<string>Fullscreen</string>
<item row="13" column="1" colspan="4">
<spacer name="spacerRepos">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item row="14" column="1" colspan="9">
<widget class="QPlainTextEdit" name="plainTextEditRepos">
<property name="lineWrapMode">
<enum>QPlainTextEdit::NoWrap</enum>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="plainText">
<string>http://downloads.vcmi.eu/Mods/repository.json</string>
</property>
</widget>
</item>
<item row="2" column="9">
<widget class="QPushButton" name="openUserDataDir">
<property name="text">
<string>Open</string>
</property>
</widget>
</item>
<item row="1" column="7">
<widget class="QLineEdit" name="lineEditGameDir">
<property name="minimumSize">
<property name="sizeHint" stdset="0">
<size>
<width>150</width>
<height>0</height>
<width>20</width>
<height>8</height>
</size>
</property>
<property name="text">
<string>/usr/share/vcmi</string>
</property>
</widget>
</spacer>
</item>
<item row="8" column="4">
<widget class="QComboBox" name="comboBoxNeutralAI">
<item>
<property name="text">
<string>StupidAI</string>
</property>
</item>
<item row="11" column="4">
<widget class="QComboBox" name="comboBoxFriendlyAI">
<property name="editable">
<bool>false</bool>
</property>
<property name="currentText">
<string>BattleAI</string>
</property>
<item>
<property name="text">
<string>BattleAI</string>
</property>
</item>
</widget>
</item>
<item row="3" column="9">
<widget class="QPushButton" name="openTempDir">
<property name="text">
<string>Open</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="labelResolution">
<property name="text">
<string>Resolution</string>
</property>
</widget>
</item>
<item row="8" column="1">
<widget class="QLabel" name="labelNeutralAI">
<property name="text">
<string>Neutral AI</string>
</property>
</widget>
</item>
<item row="8" column="6">
<widget class="QLabel" name="labelEncoding">
<property name="text">
<string>Heroes III character set</string>
</property>
</widget>
</item>
<item row="7" column="4">
<widget class="QComboBox" name="comboBoxPlayerAI">
<item>
<property name="text">
<string>VCAI</string>
<string>StupidAI</string>
</property>
</item>
</widget>
</item>
<item row="7" column="1">
<widget class="QLabel" name="labelPlayerAI">
<property name="text">
<string>Player AI</string>
</property>
</widget>
</item>
<item row="8" column="7" colspan="3">
<widget class="QComboBox" name="comboBoxEncoding">
<item>
@ -309,154 +548,22 @@
</item>
</widget>
</item>
<item row="7" column="6">
<widget class="QLabel" name="labelNetworkPort">
<property name="text">
<string>Network port</string>
</property>
</widget>
</item>
<item row="0" column="1" colspan="4">
<widget class="QLabel" name="labelVideo">
<item row="8" column="1">
<widget class="QLabel" name="labelAIInTheBattlefield">
<property name="font">
<font>
<weight>75</weight>
<italic>true</italic>
<bold>true</bold>
<underline>false</underline>
</font>
</property>
<property name="text">
<string>Video</string>
<string>AI in the battlefield</string>
</property>
</widget>
</item>
<item row="12" column="1" colspan="4">
<widget class="QLabel" name="labelRepositories">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Repositories</string>
</property>
</widget>
</item>
<item row="3" column="6">
<widget class="QLabel" name="labelTempDir">
<property name="text">
<string>Log files directory</string>
</property>
</widget>
</item>
<item row="2" column="7" colspan="2">
<widget class="QLineEdit" name="lineEditUserDataDir">
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>/home/user/.vcmi</string>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="7" colspan="2">
<widget class="QLineEdit" name="lineEditTempDir">
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>/home/user/.vcmi</string>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLabel" name="labelShowIntro">
<property name="text">
<string>Show intro</string>
</property>
</widget>
</item>
<item row="3" column="4">
<widget class="QComboBox" name="comboBoxShowIntro">
<property name="currentIndex">
<number>1</number>
</property>
<item>
<property name="text">
<string>Off</string>
</property>
</item>
<item>
<property name="text">
<string>On</string>
</property>
</item>
</widget>
</item>
<item row="5" column="1" colspan="4">
<spacer name="spacerSections">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>56</width>
<height>8</height>
</size>
</property>
</spacer>
</item>
<item row="9" column="1" colspan="4">
<spacer name="spacerRepos">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>8</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="6" colspan="4">
<widget class="QLabel" name="labelDataDirs">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Data Directories</string>
</property>
</widget>
</item>
<item row="1" column="5" rowspan="3">
<item row="9" column="5">
<spacer name="spacerColumns">
<property name="orientation">
<enum>Qt::Horizontal</enum>
@ -472,46 +579,20 @@
</property>
</spacer>
</item>
<item row="11" column="6">
<widget class="QComboBox" name="comboBoxAutoCheck">
<property name="currentIndex">
<number>1</number>
</property>
<item>
<property name="text">
<string>Off</string>
</property>
</item>
<item>
<property name="text">
<string>On</string>
</property>
</item>
</widget>
</item>
<item row="11" column="1" colspan="4">
<widget class="QLabel" name="labelAutoCheck">
<item row="8" column="6">
<widget class="QLabel" name="labelEncoding">
<property name="text">
<string>Check repositories on startup</string>
<string>Heroes III character set</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLabel" name="labelDisplayIndex">
<item row="9" column="1">
<widget class="QLabel" name="labelNeutralAI">
<property name="text">
<string>Display index</string>
<string>Neutral AI</string>
</property>
</widget>
</item>
<item row="4" column="4">
<widget class="QComboBox" name="comboBoxDisplayIndex">
<item>
<property name="text">
<string>0</string>
</property>
</item>
</widget>
</item>
</layout>
</widget>
<resources/>

View File

@ -219,6 +219,7 @@ public:
BONUS_NAME(SOUL_STEAL) /*val - number of units gained per enemy killed, subtype = 0 - gained units survive after battle, 1 - they do not*/ \
BONUS_NAME(TRANSMUTATION) /*val - chance to trigger in %, subtype = 0 - resurrection based on HP, 1 - based on unit count, additional info - target creature ID (attacker default)*/\
BONUS_NAME(SUMMON_GUARDIANS) /*val - amount in % of stack count, subtype = creature ID*/\
BONUS_NAME(CATAPULT_EXTRA_SHOTS) /*val - number of additional shots, requires CATAPULT bonus to work*/\
/* end of list */

View File

@ -242,7 +242,7 @@ void CQuest::getRolloverText(MetaString &ms, bool onHover) const
switch(missionType)
{
case MISSION_LEVEL:
ms.addReplacement(boost::lexical_cast<std::string>(m13489val));
ms.addReplacement(m13489val);
break;
case MISSION_PRIMARY_STAT:
{

View File

@ -14,7 +14,7 @@
#include "../ConstTransitivePtr.h"
#include "../GameConstants.h"
const ui32 SERIALIZATION_VERSION = 761;
const ui32 SERIALIZATION_VERSION = 762;
const ui32 MINIMAL_SERIALIZATION_VERSION = 753;
const std::string SAVEGAME_MAGIC = "VCMISVG";

View File

@ -111,6 +111,8 @@ public:
template <typename Handler> void serialize(Handler & h, const int version)
{
h & projectile & hit & cast;
if(version >= 762)
h & affect;
}
std::string selectProjectile(const double angle) const;

View File

@ -4054,7 +4054,15 @@ bool CGameHandler::makeBattleAction(BattleAction &ba)
auto wrapper = wrapAction(ba);
const CGHeroInstance * attackingHero = gs->curB->battleGetFightingHero(ba.side);
CHeroHandler::SBallisticsLevelInfo sbi = VLC->heroh->ballistics.at(attackingHero->getSecSkillLevel(SecondarySkill::BALLISTICS));
CHeroHandler::SBallisticsLevelInfo sbi;
if(stack->getCreature()->idNumber == CreatureID::CATAPULT)
sbi = VLC->heroh->ballistics.at(attackingHero->getSecSkillLevel(SecondarySkill::BALLISTICS));
else //may need to use higher ballistics level for creatures in future for some cases to match original H3 (upgraded cyclops etc)
{
sbi = VLC->heroh->ballistics.at(1);
sbi.shots += std::max(stack->valOfBonuses(Bonus::CATAPULT_EXTRA_SHOTS), 0);
}
auto wallPart = gs->curB->battleHexToWallPart(ba.destinationTile);
if (!gs->curB->isWallPartPotentiallyAttackable(wallPart))