1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
| // création des critères
PlayerCollection players;
players.append(new Gamer);
players.append(new Mob);
players.append(new Mob);
players.append(new Mob);
WeaponCollection weapons;
weapons.append(new Épée);
weapons.append(new Marteau);
StateCollection states;
states.append(new Attente);
states.append(new Patrouille);
states.append(new Attaque);
PerceptionCollection perceptions;
perceptions.append(new Entendre);
perceptions.append(new Voir);
perceptions.append(new Toucher);
// autant de critères que l'on veut
// Création des actions
ActionCollection actions;
actions.append(new Patrouiller);
actions.append(new Attaquer);
actions.append(new Frapper);
actions.append(new Assommer);
actions.append(new Désarmer);
// création de la table
// la table est un tableau contenant dans l'ordre player_type, weapon_type, state_type et perception_type
// mais il n'est pas nécessaire d'avoir tous les critères
Dispatcher dispatch;
// Si le joueur fait du bruit et que le mob est en attente, il commence à pattrouiller
dispatcher.append(GameType, MobType, AllType, AttenteType, EntendreType, PattrouillerAction);
// Si le mob voit le joueur, il l'attaque
dispatcher.append(GameType, MobType, AllType, AllType, VoirType, AttaquerAction);
// Si le mob peut toucher le joueur, il frappe
dispatcher.append(GameType, MobType, AllType, AttaqueType, ToucherType, FrapperAction);
// Si en plus, le mob a un marteau, il peut assommer le joueur
dispatcher.append(GameType, MobType, MarteauType, AttaqueType, ToucherType, FrapperAction);
//etc. |
Partager