Selaa lähdekoodia

cosmetic fix spell/effect

igorbat99 6 vuotta sitten
vanhempi
commit
c1f75af75c

+ 1 - 1
assets/effects/effects.txt

@@ -1,2 +1,2 @@
-melledamage
+meleedamage
 selfheal

+ 0 - 0
assets/effects/melledamage/descr.txt → assets/effects/meleedamage/descr.txt


+ 0 - 0
assets/effects/melledamage/icon.png → assets/effects/meleedamage/icon.png


+ 0 - 0
assets/spells/melledamage/descr.txt → assets/spells/meleedamagespell/descr.txt


+ 0 - 0
assets/spells/melledamage/icon.png → assets/spells/meleedamagespell/icon.png


+ 4 - 0
assets/spells/meleedamagespell/traits.txt

@@ -0,0 +1,4 @@
+1
+1
+0
+meleedamage|10|0

+ 0 - 4
assets/spells/melledamage/traits.txt

@@ -1,4 +0,0 @@
-1
-1
-0
-melledamage|10|0

+ 0 - 0
assets/spells/selfheal/descr.txt → assets/spells/selfhealspell/descr.txt


+ 0 - 0
assets/spells/selfheal/icon.png → assets/spells/selfhealspell/icon.png


+ 0 - 0
assets/spells/selfheal/traits.txt → assets/spells/selfhealspell/traits.txt


+ 2 - 2
assets/spells/spells.txt

@@ -1,2 +1,2 @@
-meleedamage
-selfheal
+meleedamagespell
+selfhealspell

+ 18 - 18
client.pro

@@ -89,7 +89,7 @@ SOURCES +=                                      \
     source/soundengine.cpp                      \
                                                 \
     source/effects/effect.cpp                   \
-    source/effects/melledamage.cpp              \
+    source/effects/meleedamage.cpp              \
     source/effects/selfheal.cpp                 \
                                                 \
     source/gui/guiscenemanager.cpp              \
@@ -101,8 +101,8 @@ SOURCES +=                                      \
     source/hotseatgame/unitsqueue.cpp           \
                                                 \
     source/spells/spell.cpp                     \
-    source/spells/selfheal.cpp                  \
-    source/spells/melledamage.cpp               \
+    source/spells/selfhealspell.cpp             \
+    source/spells/meleedamagespell.cpp          \
                                                 \
     source/units/mage.cpp                       \
     source/units/unit.cpp                       \
@@ -129,9 +129,9 @@ HEADERS +=                                      \
     include/racemanager.h                       \
     include/soundengine.h                       \
                                                 \
-    include/effects/effect.h                    \
-    include/effects/melledamage.h               \
+    include/effects/meleedamage.h               \
     include/effects/selfheal.h                  \
+    include/effects/effect.h                    \
                                                 \
     include/gui/guiscenemanager.h               \
     include/gui/scene.h                         \
@@ -142,8 +142,8 @@ HEADERS +=                                      \
     include/hotseatgame/uniticon.h              \
     include/hotseatgame/unitsqueue.h            \
                                                 \
-    include/spells/melledamage.h                \
-    include/spells/selfheal.h                   \
+    include/spells/meleedamagespell.h           \
+    include/spells/selfhealspell.h              \
     include/spells/spell.h                      \
                                                 \
     include/units/mage.h                        \
@@ -177,17 +177,17 @@ debug {
 #CONFIG += console
 
 RESOURCES +=                                    \
-    #res/hotseat_intro.qrc                       \
-    #res/hotseat_recruitment.qrc                 \
-    #res/hotseat_prebattle.qrc                   \
-    #res/hotseat_game.qrc                        \
-    #res/main_menu.qrc                           \
-    #res/hotseat_intro.qrc                       \
-                                                \
-    #res/effect_data.qrc                         \
-    #res/spell_data.qrc                          \
-    #res/unit_data.qrc                           \
-    #res/common_data.qrc
+#    res/hotseat_intro.qrc                       \
+#    res/hotseat_recruitment.qrc                 \
+#    res/hotseat_prebattle.qrc                   \
+#    res/hotseat_game.qrc                        \
+#    res/main_menu.qrc                           \
+#    res/hotseat_intro.qrc                       \
+#                                                \
+#    res/effect_data.qrc                         \
+#    res/spell_data.qrc                          \
+#    res/unit_data.qrc                           \
+#    res/common_data.qrc
 #    res/all_data.qrc
 }
 

+ 4 - 4
include/effects/melledamage.h → include/effects/meleedamage.h

@@ -2,14 +2,14 @@
 // Created by IgorBat on 23.04.2018.
 //
 
-#ifndef GAME_CLIENT_MELLEDAMAGE_H
-#define GAME_CLIENT_MELLEDAMAGE_H
+#ifndef GAME_CLIENT_MELEEDAMAGE_H
+#define GAME_CLIENT_MELEEDAMAGE_H
 #pragma once
 #include <cassert>
 #include "effects\effect.h"
 
-class MelleDamage : public Effect {
+class MeleeDamage : public Effect {
     void OperateOnCell(Cell* cell);
     void OperateOnUnit(Unit* unit);
 };
-#endif //GAME_CLIENT_MELLEDAMAGE_H
+#endif //GAME_CLIENT_MELEEDAMAGE_H

+ 4 - 4
include/spells/melledamage.h → include/spells/meleedamagespell.h

@@ -2,14 +2,14 @@
 // Created by IgorBat on 23.04.2018.
 //
 
-#ifndef GAME_CLIENT_MELLEDAMAGE_H
-#define GAME_CLIENT_MELLEDAMAGE_H
+#ifndef GAME_CLIENT_MELEEDAMAGE_H
+#define GAME_CLIENT_MELEEDAMAGE_H
 #pragma once
 #include <cassert>
 #include "spells\spell.h"
 
-class MelleDamage : public Spell {
+class MeleeDamageSpell : public Spell {
     void CastSpell(Cell* from, Cell* where, Unit* who, Unit* whom);
 };
 
-#endif //GAME_CLIENT_MELLEDAMAGE_H
+#endif //GAME_CLIENT_MELEEDAMAGE_H

+ 1 - 1
include/spells/selfheal.h → include/spells/selfhealspell.h

@@ -8,7 +8,7 @@
 #include <cassert>
 #include "spells\spell.h"
 
-class SelfHeal : public Spell {
+class SelfHealSpell : public Spell {
     void CastSpell(Cell* from, Cell* where, Unit* who, Unit* whom);
 };
 

+ 3 - 13
include/spells/spell.h

@@ -9,20 +9,16 @@
 #include <iostream>
 #include <vector>
 #include <list>
+#include "cell.h"
+#include "units/unit.h"
 //#include "AbstractFactory.h"
 #include "effects/effect.h"
 
-class Unit{
-    std :: list <Effect> effectsOnUnit;
-};
-class Cell{
-    std :: list <Effect> effectsOnCell;
-};
 class Spell : public QObject {
     Q_OBJECT
 
 protected:
-    std :: list <Effect> effects_;
+    std :: vector <Effect*> effects_;
 private:
     int distance_;
     bool forCell_;
@@ -41,12 +37,6 @@ public:
 
     virtual void CastSpell(Cell* from, Cell* where, Unit* who, Unit* whom) = 0;
 
-    int getDistance();
-    void setDistance(int Value);
-
-    bool getForCell();
-    void setForCell(bool Value);
-
     QString getSpellName() const;
     QString getSpellDescr() const;
     QImage getSpellIcon() const;

+ 2 - 11
res/effect_data.qrc

@@ -1,19 +1,10 @@
 <RCC>
     <qresource prefix="/">
-        <file>../assets/effects/melledamage/descr.txt</file>
-        <file>../assets/effects/melledamage/icon.png</file>
         <file>../assets/effects/selfheal/descr.txt</file>
         <file>../assets/effects/selfheal/icon.png</file>
         <file>../assets/effects/effects.txt</file>
         <file>../assets/effects/README.md</file>
-        <file>../assets/common/window/strong_translucent-background.png</file>
-        <file>../assets/common/window/strong_translucent-border_bottom.png</file>
-        <file>../assets/common/window/strong_translucent-border-botleft.png</file>
-        <file>../assets/common/window/strong_translucent-border-botright.png</file>
-        <file>../assets/common/window/strong_translucent-border-left.png</file>
-        <file>../assets/common/window/strong_translucent-border-right.png</file>
-        <file>../assets/common/window/strong_translucent-border-top.png</file>
-        <file>../assets/common/window/strong_translucent-border-topleft.png</file>
-        <file>../assets/common/window/strong_translucent-border-topright.png</file>
+        <file>../assets/effects/meleedamage/descr.txt</file>
+        <file>../assets/effects/meleedamage/icon.png</file>
     </qresource>
 </RCC>

+ 8 - 8
res/spell_data.qrc

@@ -1,12 +1,12 @@
 <RCC>
     <qresource prefix="/">
-        <file>../assets/skills/melledamage/descr.txt</file>
-        <file>../assets/skills/melledamage/icon.png</file>
-        <file>../assets/skills/melledamage/traits.txt</file>
-        <file>../assets/skills/selfheal/descr.txt</file>
-        <file>../assets/skills/selfheal/icon.png</file>
-        <file>../assets/skills/selfheal/traits.txt</file>
-        <file>../assets/skills/README.md</file>
-        <file>../assets/skills/skills.txt</file>
+        <file>../assets/spells/meleedamagespell/descr.txt</file>
+        <file>../assets/spells/meleedamagespell/icon.png</file>
+        <file>../assets/spells/meleedamagespell/traits.txt</file>
+        <file>../assets/spells/selfhealspell/descr.txt</file>
+        <file>../assets/spells/selfhealspell/icon.png</file>
+        <file>../assets/spells/selfhealspell/traits.txt</file>
+        <file>../assets/spells/README.md</file>
+        <file>../assets/spells/spells.txt</file>
     </qresource>
 </RCC>

+ 3 - 4
source/effects/melledamage.cpp → source/effects/meleedamage.cpp

@@ -2,17 +2,16 @@
 // Created by IgorBat on 23.04.2018.
 //
 
-#pragma once
 #include <cassert>
-#include "effects\melledamage.h"
+#include "effects\meleedamage.h"
 #include "units\unit.h"
 #include <string>
 
-void MelleDamage::OperateOnCell(Cell* cell){
+void MeleeDamage::OperateOnCell(Cell* cell){
     throw std :: string("CAN'T TOUCH THIS");
 }
 
-void MelleDamage::OperateOnUnit(Unit* unit){
+void MeleeDamage::OperateOnUnit(Unit* unit){
     //int temp = unit -> reduceIncomingDamage("p", count_);
     //unit ->setHealthPoints(unit -> getHealthPoints() - temp);
     //check_on_death

+ 3 - 5
source/effects/selfheal.cpp

@@ -1,19 +1,17 @@
 //
 // Created by IgorBat on 23.04.2018.
 //
-
-
-#pragma once
 #include <cassert>
 #include "effects\selfheal.h"
+#include "cell.h"
 #include "units\unit.h"
 #include <string>
 
 void SelfHeal::OperateOnCell(Cell* cell){
-    throw std :: string("CAN'T TOUCH THIS")
+    throw std :: string("CAN'T TOUCH THIS");
 }
 
 void SelfHeal::OperateOnUnit(Unit* unit){
-    unit.setHealthPoints(unit.getHealthPoints() + count_);
+    //unit.setHealthPoints(std :: min(unit.getHealthPoints() + count_ > unit->getMaxHealthPoints());
     //check_on_is_it_max
 }

+ 13 - 0
source/spells/meleedamagespell.cpp

@@ -0,0 +1,13 @@
+//
+// Created by IgorBat on 23.04.2018.
+//
+#pragma once
+#include <cassert>
+#include "spells/meleedamagespell.h"
+#include "units/unit.h"
+#include "cell.h"
+#include <string>
+
+void MeleeDamageSpell::CastSpell(Cell* from, Cell* where, Unit* who, Unit* whom){
+    effects_[0] -> OperateOnUnit(whom);
+}

+ 0 - 7
source/spells/melledamage.cpp

@@ -1,7 +0,0 @@
-//
-// Created by IgorBat on 23.04.2018.
-//
-
-void MelleDamage::CastSpell(Cell* from, Cell* where, Unit* who, Unit* whom){
-    effects_[0] -> OperateOnUnit(whom);
-}

+ 0 - 7
source/spells/selfheal.cpp

@@ -1,7 +0,0 @@
-//
-// Created by IgorBat on 23.04.2018.
-//
-
-void SelfHeal::CastSpell(Cell* from, Cell* where, Unit* who, Unit* whom){
-    effects_[0] -> OperateOnUnit(who);
-}

+ 14 - 0
source/spells/selfhealspell.cpp

@@ -0,0 +1,14 @@
+//
+// Created by IgorBat on 23.04.2018.
+//
+#pragma once
+#include <cassert>
+#include "spells/selfhealspell.h"
+#include "units/unit.h"
+#include "cell.h"
+#include <string>
+
+
+void SelfHealSpell::CastSpell(Cell* from, Cell* where, Unit* who, Unit* whom){
+    effects_[0] -> OperateOnUnit(who);
+}

+ 5 - 5
source/spells/spell.cpp

@@ -17,7 +17,7 @@
 Spell::Spell(QString parameters) {
     QStringList params = parameters.split("\n");
     assert(params.size() >= 1);
-    spell_name_ = param[0];
+    spell_name_ = params[0];
     QString spell_folder = ":/assets/skills/" + spell_name_ + "/";
 
     loadSpellDescr(spell_folder);
@@ -59,17 +59,17 @@ QImage Spell::getSpellIcon() const {
 int Spell::getDistance(){
     return distance_;
 }
-void setDistance(int value){
+void Spell::setDistance(int value){
     distance_ = value;
 }
 
-bool getForCell(){
+bool Spell::getForCell(){
     return forCell_;
 }
-void setForCell(bool value){
+void Spell::setForCell(bool value){
     forCell_ = value;
 }
 bool Spell::canCastToCell(Cell* destination, Cell* from){
-    if(from -> lenOfActualPath(destination) == 1) return true;
+    //if(from -> lenOfActualPath(destination) == 1) return true;
     return false;
 }