Un petit système pour brûler des maisons

Bonjour

J’ai programmé ce petit code pour permettre, dans le jeu, de définir que certains bâtiments sont incendiables, et gérer tout ça. Si quelqu’un a des suggestions …

Dans un second post je vous ferai part d’un petit problème technique sur lequel j’achoppe…

[code]A thing can be trucinflammable. A thing is usually not trucinflammable.

A thing can be burnt. A thing is usually not burnt.
A thing can be burnable. A thing is usually burnable.

A batimentbois is a kind of backdrop. It is burnable.
A batimentbois has a room called interieur.

A batimentpierre is a kind of backdrop. It is not burnable.

A person is usually not burnable.

Instead of burning a batimentbois:
if the player is in a room which is dedans
begin;
say « Vous n’allez pas incendier le bâtiment même où vous vous trouvez… »;
stop the action;
otherwise if the player is in a room which is dehors;
if player is carrying something which is trucinflammable
begin;
if the noun is not burnable
begin;
say « Vous ne pouvez pas brûler cela. »;
stop the action;
end if; [ !!!]
if the noun is burnt
begin;
say « C’est déjà carbonisé… »;
stop the action;
end if; [ !!!]
if the player is Neige for more than 15 turns
begin;
say « La neige vous empêche de faire du feu. »;
stop the action;
otherwise if the player is Pluie for more than 20 turns;
say « La pluie vous empêche de faire du feu. »;
stop the action;
otherwise;
say « Vous incendiez [the noun] ; [if the noun is male]Il[otherwise if the noun is female]Elle[end if] part en fumée. »;
now the noun is burnt;
end if;
otherwise;
say « Vous n’avez rien sur vous pour faire partir un feu. »;
stop the action;
end if;
end if.

Instead of doing something to something:
if the noun is burnt
begin;
say « Vous ne pouvez pas, [the noun] est [if the noun is male]carbonisé[otherwise if the noun is female]carbonisée[end if]… »;
stop the action;
end if.

[Instead of going inside when the location of the player contains a burnt batimentbois:
say « Vous ne pouvez pas y entrer, le bâtiment est en cendres, effondré au sol… »;
stop the action.]

Instead of examining a burnt thing:
say « [the description of the noun]. ».[/code]

Voilà pour la base du truc, maintenant, un cas concret :

[code]The cabanechamps is a female batimentbois. It is in Champs and in Danscabanechamps. The printed name is « [if cabanechamps is burnt]cabane carbonisée[otherwise]cabane[end if] ».

The interieur of cabanechamps is Danscabanechamps.

the bunker is a male batimentpierre in Champs.

Instead of examining the cabanechamps, say « [if cabanechamps is not burnt]Une cabane en bois, vieille et un peu bancale, en planches grossières.[otherwise]Un tas de cendres et de planches à moitié carbonisées…[end if] ».

[ pas de " description " pour des backdrops ]

Understand « cabane » or « cabane en bois » as the cabanechamps. The cabanechamps is burnable.

Gerard is a man. Gerard is in Danscabanechamps. The printed name is « [if Gerard is not dead]Gerard[otherwise if Gerard is burnt]le corps carbonisé de Gerard[otherwise if Gerard is dead]le cadavre de Gerard[end if] »

Danscabanechamps is a room. Inside from champs is Danscabanechamps. Danscabanechamps is dedans. The exterieur of Danscabanechamps is Champs.

The printed name of Danscabanechamps is « Dans la vieille cabane ». The description of danscabanechamps is « A l’intérieur de la cabane - il n’y a rien, si ce n’est quelques bouteilles de vin, vides, au sol. ».

Before burning a batimentbois (called B):
now each person in the interieur of B is burnt;
now each person in the interieur of B is dead;
move Gerard to the exterieur of the interieur of B.[/code]

Voilà, bon, ça contraint à définir pas mal de choses dès qu’on veut insérer un bâtiment incendiable - en caser 10 par room serait compliqué - mais ça fonctionne (de manière grossière : en un seul tour le batiment est détruit et ses occupants tués, j’ai testé avec un et plusieurs PNJ. Ca contraint aussi pour chaque PNJ, de lui attribuer un printed name particulier au cas où il meurt dans l’incendie.

Bref en jeu ça donne ça :

.

Et donc j’ai un petit problème avec cette partie-là du code :

Before burning a batimentbois (called B): now each person in the interieur of B is burnt; now each person in the interieur of B is dead; move Gerard to the exterieur of the interieur of B.

Avec ce brave Gérard, ça marche, mais si je veux le remplacer par une formule du genre " each person in the interieur of B" , ça ne marche pas … quelqu’un a-t-il une idée pour que toutes les victimes dans une maison incendiées, soient déplacées vers la room qui contient la room « détruite » ?

regarde ici l’exemple ici : inform7.com/learn/man/ex379.html#e379

Ou peut-être plus proche de ce que tu cherches ici :

ifiction.free.fr/concours2007/he … ce_11.html

[code]A clou is a kind of thing. In the Void are 14 clous.

To bring a clou to the location:
let item be a random clou in the Void;
move item to the location.

To bring (n - a number) clous to the location:
repeat with i running from 1 to n
begin;
bring a clou to the location;
end repeat.

To bring a clou to the sac:
let item be a random clou carried by the player;
move item to the sac. [/code]

ici tes personnages sont définis, donc peut-être que c’est différent, mais si tu les places dans une classe particulière, je pense que tu peux les déplacer avec cette syntaxe.

Voilà en fait le code qui fonctionne et que je viens de trouver enfin

Before burning a batimentbois (called B): now each person in the interieur of B is burnt; now each person in the interieur of B is dead; now each person in the interieur of B is in the exterieur of the interieur of B.

Inform 7, c’est si simple :slight_smile:
En fait c’est la suite logique du reste.