Commit 4760b0e5 authored by Remy Garnier's avatar Remy Garnier
Browse files

Merge branch 'master' of gitlab.crans.org:genie_logiciel_2015/the_dungeon_project

parents ed5b2ea2 56c0ed92
......@@ -7,6 +7,7 @@ import smtplib, argparse
from email.mime.text import MIMEText
parser = argparse.ArgumentParser()
parser.add_argument("mail", help="mail of the receiver")
parser.add_argument("filename", help="file containing the corp of the mail")
args = parser.parse_args()
......@@ -14,10 +15,11 @@ with open(args.filename) as fp:
# Create a text/plain message
msg = MIMEText(fp.read())
msg['Subject'] = 'Continuous Integration of the the_dungeon_project : Error'
msg['From'] = 'the_dungeon_project@ci.org'
msg['To'] = args.mail
msg['Reply-To'] = 'ens-info-genielog-2015@lists.crans.org'
msg['To'] = 'ens-info-genielog-2015@lists.crans.org'
msg['Subject'] = 'Continuous Integration of the the_dungeon_project : Error'
# Send the message via our own SMTP server.
s = smtplib.SMTP('smtp.crans.org')
......
......@@ -6,12 +6,20 @@ make clean
if ! make; then
echo 'Compilation error in the master branch.' > CI/msg
echo 'Result of make :\n' >> CI/msg
make 2>> CI/msg
make 2>> CI/msgerror
cat CI/msgerror >> CI/msg
echo '\n-- \nCI script' >> CI/msg
# Kludge : pas de serveur smtp accessible depuis la salle.
scp CI/msg fardale@acerarien.crans.org:the_dungeon_project/
ssh fardale@acerarien.crans.org './the_dungeon_project/mailci.py ./the_dungeon_project/msg'
scp CI/msg fardale@crash-test.crans.org:the_dungeon_project/
ssh fardale@crash-test.crans.org './the_dungeon_project/mailci.py "ens-info-genielog-2015@lists.crans.org" ./the_dungeon_project/msg'
rm -f CI/msg
echo 'It seems that your commit breaks the compilation of the project.' > CI/msg
echo 'Result of make :\n' >> CI/msg
cat CI/msgerror >> CI/msg
echo '\n-- \nCI script' >> CI/msg
# Kludge : pas de serveur smtp accessible depuis la salle.
scp CI/msg fardale@crash-test.crans.org:the_dungeon_project/
ssh fardale@crash-test.crans.org "./the_dungeon_project/mailci.py $(git log -n 1 | grep Author | sed "s/.*<\(.*\)>/\1/g") ./the_dungeon_project/msg"
fi
exit 0
#!/usr/bin/python3
import http.server
import subprocess
import sys
def ssh(host, command):
cossh = subprocess.Popen(["ssh", "%s" % host, command], shell=False, stdout=subprocess.PIPE)
print(cossh.stdout.readlines())
PORT = 8080
server_address = ("", PORT)
server = http.server.HTTPServer
handler = http.server.SimpleHTTPRequestHandler
print("Serveur actif sur le port :", PORT)
httpd = server(server_address, handler)
while True:
httpd.handle_request()
ssh("01.dptinfo.ens-cachan.fr", "cd projet_genielog/the_dungeon_project/; git pull")
......@@ -61,7 +61,7 @@ $(BIN)%.class : $(SRC)%.java
# Hack pour bin/
hack :
@mkdir -p bin;
@mkdir -p bin/log;
buildplay: all
cd bin/; java -cp $(LIB)*:. graphics.guiSkeleton.Igniter_Main
......
......@@ -13,13 +13,31 @@ To run
################### HOW TO PLAY ###################
1)Launch the game. 2)On the main panel, you may : 2.1) single player : starts the game in a single player mode 2.2) multi player : TODO 2.3) configuration : you may configure the keys used to play the game 2.4) IGP : stands for "in game programming" : you may configure your own A.I. for the game 2.5) exit : leaves the game
1)Launch the game.
3)Once you are in game : For now, the basic configuration is : Move left : left_arrow Move right : right_arrow Move up : up_arrow Move down : down_arrow Attack : a Spell : s Back to main : escape
2)On the main panel, you may :
2.1) single player : starts the game in a single player mode
2.2) multi player : enables to create/join a multi player mode
2.3) configuration : you may configure the keys used to play the game
2.4) IGP : stands for "in game programming" : you may configure your own A.I. for your game allies
2.5) exit : leaves the game : be careful configuration keys are not registered
3)Default commands:
-Move left : left_arrow
-Move right : right_arrow
-Move up : up_arrow
-Move down : down_arrow
-Attack : a
-Ability1 : z
-Ability1 : e
-Ability1 : r
-Back to main : escape
################### HOW TO DOCUMENT ###################
To document the project, you need the package doxygen. It will create a HTML documentation from the code. To have inheritance graphs, please install graphivz.
To document the project, you need the package doxygen.
It will create a HTML documentation from the code.
To have inheritance graphs, please install graphivz.
English versions :
......@@ -37,26 +55,6 @@ Without graphivz
make doc-html2-fr
################### HOW TO PLAY ###################
1)Launch the game.
2)On the main panel, you may :
2.1) single player : starts the game in a single player mode
2.2) multi player : TODO
2.3) configuration : you may configure the keys used to play the game
2.4) IGP : stands for "in game programming" : you may configure your own A.I. for the game
2.5) exit : leaves the game
3)Once you are in game :
For now, the basic configuration is :
Move left : left_arrow
Move right : right_arrow
Move up : up_arrow
Move down : down_arrow
Attack : a
Spell : s
Back to main : escape
################### PRINCIPLE OF THE GAME ###################
TODO
......@@ -87,6 +85,4 @@ The following people were the developers :
-Ringeade Clément
-Toussaint Etienne
-Thomas Colin
-Ursu Bogdan
TODO : missing names to fill because not registered
-Ursu Bogdan
\ No newline at end of file
......@@ -40,7 +40,7 @@ public class AIControler {
ai = new DefenderEntity(gameContent,dmr);
break;
default:
LOGGER.warning("Trying to instanciate unrecognized type of AI.");
LOGGER.severe("Trying to instanciate unrecognized type of AI.");
break;
}
list.add(ai);
......
......@@ -30,7 +30,10 @@ public class BasicEntity extends AbstractEntity {
*/
@Override
public void act() {
//this.move_to_victim(this.Choose_victim());
// basic targeting and pathfinding
this.move_to_victim(this.Choose_victim());
// A*
List<Entity> entityList=gameState.getAllEntities();
int dX = entityList.get(this.Choose_victim()).getX();
int dY = entityList.get(this.Choose_victim()).getY();
......@@ -40,6 +43,7 @@ public class BasicEntity extends AbstractEntity {
System.out.println(dir);
this.relayer.move(dir);
// attack
this.relayer.tryToCastAbility(0);
}
}
# Fichier contenant l'ensemble des species du jeu.
# Nombre de species total
2
5
#Ronflex - Character
C
......@@ -21,6 +21,12 @@ R
RONFLEX
#triggers
0
#abilityList
4
TEST_ATTACK_ABILITY
TEST_FIREBOLT
NULL_ABILITY
TEST_SUICIDE
#hitbox
R
15
......@@ -44,12 +50,6 @@ DARK
1
#baseIntel
1
#abilityList
4
TEST_ATTACK_ABILITY
NULL_ABILITY
NULL_ABILITY
NULL_ABILITY
#--------------------------------------------------------------------
#Mentali - Character
C
......@@ -70,6 +70,12 @@ R
CHATROSE
#triggers
0
#abilityList
4
TEST_ATTACK_ABILITY
TEST_FIREBOLT
NULL_ABILITY
TEST_SUICIDE
#hitbox
R
10
......@@ -93,9 +99,138 @@ DARK
1
#baseIntel
1
#--------------------------------------------------------------------
#Ponyta - Character
C
#name
Ponyta
#tilePropertyVector
2
SOLID
LIQUID
#collisionBox
R
15
15
#visilibity
R
200
200
#entityDisplayerType
PONYTA
#triggers
0
#abilityList
4
1
TEST_ATTACK_ABILITY
NULL_ABILITY
NULL_ABILITY
NULL_ABILITY
\ No newline at end of file
#hitbox
R
10
10
#damageTypeVector
7
NEUTRAL
FIRE
ICE
THUNDER
WATER
LIGHT
DARK
#baseHP
10
#baseDef
1
#baseMental
1
#baseAtk
1
#baseIntel
1
#--------------------------------------------------------------------
#Diagla - Character
C
#name
Diagla
#tilePropertyVector
2
SOLID
LIQUID
#collisionBox
R
15
15
#visilibity
R
200
200
#entityDisplayerType
DIAGLA
#triggers
0
#abilityList
1
TEST_ATTACK_ABILITY
#hitbox
R
10
10
#damageTypeVector
7
NEUTRAL
FIRE
ICE
THUNDER
WATER
LIGHT
DARK
#baseHP
10
#baseDef
1
#baseMental
1
#baseAtk
1
#baseIntel
1
#--------------------------------------------------------------------
#Firebolt- Entity
E
#name
FireBolt
#tilePropertyVector
2
SOLID
LIQUID
#collisionBox
R
15
15
#visilibity
R
200
200
#entityDisplayerType
DIAGLA
#triggers
0
#abilityList
1
TEST_SUICIDE
#hitbox
R
15
15
#damageTypeVector
1
FIRE
#baseHP
1
#baseDef
0
#baseMental
0
#baseAtk
0
#baseIntel
0
......@@ -11,10 +11,10 @@ import java.util.List;
/**
* Created by hilaire on 16/12/15.
*
* cooldown system originally designed by Guillaume Hocquet
* cooldown system originally designed by ghocquet
*/
public class Ability implements Serializable{
private static final long serialVersionUID = 1L;
private int cooldown_ms;
private long lastUseTime = 0 ;
......
......@@ -5,5 +5,7 @@ package core.abilities;
*/
public enum AbilityKey {
NULL_ABILITY,
TEST_ATTACK_ABILITY
TEST_ATTACK_ABILITY,
TEST_FIREBOLT,
TEST_SUICIDE;
}
......@@ -24,7 +24,7 @@ public class AbilityRoster {
abilityGenerator =
() -> new Ability(
1,
500,
AbilityIconKeys.NULL_ABILITY,
Action.ATTACK,
new ArrayList<EffectDescriptor>()
......@@ -39,6 +39,24 @@ public class AbilityRoster {
new ArrayList<>(Arrays.asList(new EffectDescriptor(EffectKey.TEST_ATTACK_EFFECT, new int[]{2})))
);
abilityFactory.registerAbilityGenerator(AbilityKey.TEST_ATTACK_ABILITY, abilityGenerator);
abilityGenerator =
() -> new Ability(
2000,
AbilityIconKeys.FIRE_BOLT_1,
Action.ATTACK,
new ArrayList<>(Arrays.asList(new EffectDescriptor(EffectKey.TEST_FIREBOLT, new int[]{5,10})))
);
abilityFactory.registerAbilityGenerator(AbilityKey.TEST_FIREBOLT, abilityGenerator);
abilityGenerator =
() -> new Ability(
2000,
AbilityIconKeys.SHIELD_1,
Action.ATTACK,
new ArrayList<>(Arrays.asList(new EffectDescriptor(EffectKey.TEST_SUICIDE, new int[]{5})))
);
abilityFactory.registerAbilityGenerator(AbilityKey.TEST_SUICIDE, abilityGenerator);
}
}
package core.abilities.effects;
import core.event.AbilityEvent;
import core.gamestate.*;
import core.gamestate.Character;
import core.relayer.Relayer;
import core.relayer.RelayerEntity;
import core.zone.Direction;
import core.zone.Zone;
import gameloop.DummyLocalGameLoop;
import java.io.Serializable;
import java.util.ArrayList;
......@@ -38,13 +43,77 @@ public class EffectBuilder implements Serializable{
@Override
public void effect(List<Integer> targetCharacterIDList, GameContent gameContent, int casterCharacterID) {
for (Integer targetID : targetCharacterIDList) {
gameContent.getGameState().getCharacter(targetID).takeDamage(Math.max(howMany, 0));
try {
gameContent.getGameState().getCharacter(targetID).takeDamage(Math.max(howMany, 0));
} catch (EntityNotFoundExeption entityNotFoundExeption) {
entityNotFoundExeption.printStackTrace();
}
}
}
};
}
Effect spawnFireBolt(int degat,int speed) {
return new Effect() {
private static final long serialVersionUID = 1L;
@Override
public void effect(List<Integer> targetCharacterIDList, GameContent gameContent, int casterCharacterID) {
Character charac = null;
try {
charac = gameContent.getGameState().getCharacter(casterCharacterID);
} catch (EntityNotFoundExeption entityNotFoundExeption) {
entityNotFoundExeption.printStackTrace();
return ;
}
Entity entity = SpeciesArray.create(charac.getX(), charac.getY(), 0, "FireBolt", "FireBolt");
entity.setOrientation(charac.getOrientation());
entity.setSpeed(speed);
gameContent.getGameState().addEntity(entity);
RelayerEntity relayer = new RelayerEntity(entity.getID(),entity,gameContent);
entity.setRelayer(relayer);
relayer.move(DummyLocalGameLoop.getInstance().getFollowedRelayer().getDirection());
relayer.start();
//Direction direction = gameContent.getGameState().getCharacter(casterCharacterID).getDirection();
//Entity n_entity = new Entity()
}
};
}
Effect suicide(int howMany) {
return new Effect() {
private static final long serialVersionUID = 1L;
@Override
public void effect(List<Integer> targetCharacterIDList, GameContent gameContent, int casterCharacterID) {
for (Integer targetID : targetCharacterIDList) {
try {
gameContent.getGameState().getCharacter(targetID).takeDamage(Math.max(howMany, 0));
} catch (EntityNotFoundExeption entityNotFoundExeption) {
entityNotFoundExeption.printStackTrace();
continue;
}
}
try {
if(gameContent.getGameState().getEntity(casterCharacterID).getRelayer() != null){
gameContent.getGameState().getEntity(casterCharacterID).getRelayer().kill();
}
gameContent.getGameState().removeEntity(gameContent.getGameState().getEntity(casterCharacterID));
} catch (EntityNotFoundExeption entityNotFoundExeption) {
entityNotFoundExeption.printStackTrace();
return;
}
//gameContent.getGameState().getCharacter(casterCharacterID).takeDamage(Math.max(gameContent.getGameState().getCharacter(casterCharacterID).getMaxHP(), 0));
}
};
}
/** Methods to be applied on an Effect to transform it into another one **/
/**
......@@ -130,7 +199,13 @@ public class EffectBuilder implements Serializable{
List<Integer> newTargetCharacterIDList = new ArrayList<>();
//TODO: The following could be written in a more functional way
for (Integer targetID : targetCharacterIDList) {
Character target = gameContent.getGameState().getCharacter(targetID);
Character target = null;
try {
target = gameContent.getGameState().getCharacter(targetID);
} catch (EntityNotFoundExeption entityNotFoundExeption) {
entityNotFoundExeption.printStackTrace();
continue;
}
for (Character newTarget : gameContent.getGameState().getCharacters(crz.apply(target))) {
newTargetCharacterIDList.add(newTarget.getID());
}
......
......@@ -27,6 +27,21 @@ public final class EffectGeneratorRoster {
eb.reduceHP(amountOfDamage)));
};
effectFactory.registerEffectGenerator(EffectKey.TEST_ATTACK_EFFECT, effectGenerator);
effectGenerator =
(casterCharacterID, parameters) -> {
int amountOfDamage = parameters.getNthParameter(0);
int speed = parameters.getNthParameter(1);
return eb.spawnFireBolt(amountOfDamage,speed);
};
effectFactory.registerEffectGenerator(EffectKey.TEST_FIREBOLT, effectGenerator);
effectGenerator =
(casterCharacterID, parameters) -> {
int amountOfDamage = parameters.getNthParameter(0);
return eb.suicide(amountOfDamage);
};
effectFactory.registerEffectGenerator(EffectKey.TEST_SUICIDE, effectGenerator);
}
}
......@@ -8,7 +8,9 @@ package core.abilities.effects;
* are bound to requires (in addition to the ID of the caster character).
*/
public enum EffectKey {
TEST_ATTACK_EFFECT(1);
TEST_ATTACK_EFFECT(1),
TEST_FIREBOLT(2),
TEST_SUICIDE(1);
private EffectKey(int parameterNb) {
this.parameterNb = parameterNb;
......
......@@ -2,6 +2,8 @@ package core.event;
import core.abilities.*;
import core.abilities.effects.*;
import core.gamestate.Entity;
import core.gamestate.EntityNotFoundExeption;
import core.gamestate.GameContent;
import core.gamestate.Character;
......@@ -30,7 +32,9 @@ public class AbilityEvent implements ClientEvent,ServerEvent {
@Override
public boolean execute(GameContent gameContent) {
Character potentialCaster = gameContent.getGameState().getCharacter(potentialCasterCharacterID);
Entity potentialCaster = null;
try {
potentialCaster = gameContent.getGameState().getEntity(potentialCasterCharacterID);
Ability abilityPotentiallyCasted = potentialCaster.getAbilityList().get(abilityNb);
List<EffectDescriptor> effectDescriptorList = abilityPotentiallyCasted.cast();
......@@ -50,6 +54,10 @@ public class AbilityEvent implements ClientEvent,ServerEvent {
//Ability not cast
}
return true;
} catch (EntityNotFoundExeption entityNotFoundExeption) {
entityNotFoundExeption.printStackTrace();
return false;
}
}
@Override
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment