Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add feather flag implementation #45995

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions data/json/monsters/bird.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"baby_flags": [ "SPRING", "SUMMER", "AUTUMN", "WINTER" ],
"biosignature": { "biosig_item": "feces_bird", "biosig_timer": 3 },
"death_function": [ "NORMAL" ],
"flags": [ "SEES", "HEARS", "SMELLS", "ANIMAL", "PATH_AVOID_DANGER_1", "WARM", "BIRDFOOD" ]
"flags": [ "SEES", "HEARS", "SMELLS", "ANIMAL", "PATH_AVOID_DANGER_1", "WARM", "BIRDFOOD", "FEATHER" ]
},
{
"id": "mon_grouse",
Expand Down Expand Up @@ -70,7 +70,7 @@
"reproduction": { "baby_egg": "egg_crow", "baby_count": 3, "baby_timer": 8 },
"baby_flags": [ "SPRING" ],
"biosignature": { "biosig_item": "feces_bird", "biosig_timer": 8 },
"flags": [ "SEES", "HEARS", "SMELLS", "ANIMAL", "PATH_AVOID_DANGER_1", "WARM", "FLIES" ]
"flags": [ "SEES", "HEARS", "SMELLS", "ANIMAL", "PATH_AVOID_DANGER_1", "WARM", "FLIES", "FEATHER" ]
},
{
"id": "mon_duck",
Expand Down Expand Up @@ -100,7 +100,7 @@
"reproduction": { "baby_egg": "egg_duck", "baby_count": 3, "baby_timer": 5 },
"baby_flags": [ "SPRING" ],
"biosignature": { "biosig_item": "feces_bird", "biosig_timer": 5 },
"flags": [ "SEES", "HEARS", "SMELLS", "ANIMAL", "PATH_AVOID_DANGER_1", "WARM", "FLIES" ]
"flags": [ "SEES", "HEARS", "SMELLS", "ANIMAL", "PATH_AVOID_DANGER_1", "WARM", "FLIES", "FEATHER" ]
},
{
"id": "mon_goose_canadian",
Expand Down Expand Up @@ -145,7 +145,7 @@
"reproduction": { "baby_egg": "egg_turkey", "baby_count": 3, "baby_timer": 12 },
"baby_flags": [ "SPRING", "SUMMER" ],
"biosignature": { "biosig_item": "feces_bird", "biosig_timer": 8 },
"flags": [ "SEES", "HEARS", "SMELLS", "ANIMAL", "PATH_AVOID_DANGER_1", "WARM", "FLIES" ]
"flags": [ "SEES", "HEARS", "SMELLS", "ANIMAL", "PATH_AVOID_DANGER_1", "WARM", "FLIES", "FEATHER" ]
},
{
"id": "mon_pheasant",
Expand Down Expand Up @@ -219,7 +219,7 @@
"harvest": "bird_tiny",
"death_function": [ "NORMAL" ],
"upgrades": { "age_grow": 14, "into": "mon_chicken" },
"flags": [ "SEES", "HEARS", "SMELLS", "ANIMAL", "PATH_AVOID_DANGER_1", "WARM", "BIRDFOOD" ]
"flags": [ "SEES", "HEARS", "SMELLS", "ANIMAL", "PATH_AVOID_DANGER_1", "WARM", "BIRDFOOD", "FEATHER" ]
},
{
"id": "mon_grouse_chick",
Expand Down Expand Up @@ -302,7 +302,7 @@
"death_function": [ "NORMAL" ],
"biosignature": { "biosig_item": "feces_bird", "biosig_timer": 8 },
"upgrades": { "half_life": 10, "into_group": "GROUP_CROW_MUTANT" },
"flags": [ "SEES", "HEARS", "SMELLS", "PATH_AVOID_DANGER_1", "WARM", "FLIES" ]
"flags": [ "SEES", "HEARS", "SMELLS", "PATH_AVOID_DANGER_1", "WARM", "FLIES", "FEATHER" ]
},
{
"id": "mon_crow_mutant",
Expand Down Expand Up @@ -330,7 +330,7 @@
"harvest": "bird_large",
"special_attacks": [ [ "SHRIEK", 10 ], [ "LUNGE", 8 ], { "type": "leap", "cooldown": 10, "max_range": 3 } ],
"death_function": [ "NORMAL" ],
"flags": [ "SEES", "HEARS", "SMELLS", "PATH_AVOID_DANGER_1", "STUMBLES", "WARM" ]
"flags": [ "SEES", "HEARS", "SMELLS", "PATH_AVOID_DANGER_1", "STUMBLES", "WARM", "FEATHER" ]
},
{
"id": "mon_pigeon",
Expand Down
2 changes: 1 addition & 1 deletion doc/JSON_FLAGS.md
Original file line number Diff line number Diff line change
Expand Up @@ -938,7 +938,7 @@ Other monster flags.
- ```ELECTRIC``` Shocks unarmed attackers.
- ```ELECTRONIC``` e.g. A Robot; affected by emp blasts and other stuff.
- ```FAT``` May produce fat when butchered.
- ```FEATHER``` May produce feathers when butchered.
- ```FEATHER``` May lose feathers when attacked and when moved.
- ```FILTHY``` Any clothing it drops will be filthy. The squeamish trait prevents wearing clothing with this flag, one can't craft anything from filthy components, and wearing filthy clothes may result in infection if hit in melee.
- ```FIREPROOF``` Immune to fire.
- ```FIREY``` Burns stuff and is immune to fire.
Expand Down
9 changes: 9 additions & 0 deletions src/creature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -961,6 +961,15 @@ void Creature::deal_damage_handle_type( const effect_source &source, const damag
break;
}

if( has_flag( MF_FEATHER ) && ( du.type == damage_type::BASH || du.type == damage_type::CUT ||
du.type == damage_type::STAB || du.type == damage_type::BULLET ) ) {
// Drop some feathers
const int max_feathers = std::min( adjusted_damage, 50 );
get_map().add_item_or_charges( pos(), item( "down_feather", calendar::turn, rng( 0,
max_feathers / 2 ) ) );
get_map().add_item_or_charges( pos(), item( "feather", calendar::turn, rng( 1, max_feathers ) ) );
}

on_damage_of_type( adjusted_damage, du.type, bp );

damage += adjusted_damage;
Expand Down
8 changes: 8 additions & 0 deletions src/monmove.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1736,6 +1736,14 @@ bool monster::move_to( const tripoint &p, bool force, bool step_on_critter,
here.add_item_or_charges( pos(), item( "gasoline" ) );
}
}
if( has_flag( MF_FEATHER ) ) {
// Sometimes drop feathers
if( one_in( 120 ) ) {
here.add_item_or_charges( pos(), item( "down_feather", calendar::turn, rng( 1, 3 ) ) );
} else if( one_in( 100 ) ) {
here.add_item_or_charges( pos(), item( "feather", calendar::turn, rng( 1, 3 ) ) );
}
}
return true;
}

Expand Down